summaryrefslogtreecommitdiffstats
path: root/src/corelib
Commit message (Collapse)AuthorAgeFilesLines
* QDateTime: Micro-optimize by using QString::fromLatin1 instead of ↵Robin Burchell2014-09-151-16/+16
| | | | | | | | | | | | | QString::fromUtf8. This data is clearly not (and will never be) utf8 data, so using fromLatin1 avoids the (slightly more expensive) utf8 mangling. I didn't see any significant impact on benchmarks, but I also wasn't specifically collecting data when making this change. Change-Id: I45190d40b2caccf15b1f9a1ae5b7dcd08cbd541f Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* QDate: Micro-optimize for fromStringIso benchmark.Robin Burchell2014-09-151-2/+2
| | | | | | | | By using QStringRef instead of QString, we avoid a data copy. This takes the QDateTime::fromStringIso benchmark from 0.79ms to 0.53ms for me. Change-Id: Ibb36067491ffc275ce3b667cb0e04941aa9457f0 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Use new, supported APIs in OS X 10.10 and iOS 8.0 to get the OS version.Jake Petroules2014-09-125-63/+71
| | | | | | | | | Gestalt is deprecated so we can't use it long term. At the same time, the new API is cross platform, so we'll no longer have to parse strings in -[UIDevice systemVersion] either. Change-Id: Ic81797174c1a3d50b47b9b209205a6a506cc75ef Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
* Micro-optimize qt_section_chunk ctorMarc Mutz2014-09-121-1/+1
| | | | | | | Use C++11 move semantics, and the ctor-init-list. Change-Id: I1a5faa83ef552e8d98ce994edf967770a73cab0e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QFileSelector: use qEnvironmentVariableIsEmpty()Marc Mutz2014-09-121-1/+1
| | | | | | | | It doesn't allocate memory, so cannot throw and is a lot faster than qgetenv(). Change-Id: Ib303f00ce45816677ffca0580cc6b91a14a0e5be Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* QHash: remove unnecessary #ifdefMarc Mutz2014-09-121-3/+1
| | | | | | | | | | There's no need to use a macro here, since we can just store the pointer value in a qulonglong and have the second shift operation be done unconditionally. For 32-bit platforms, it will yield 0, and xor'ing it into 'seed' will have no effect. Change-Id: I3e63bd504e81c84d13935d5503c3707d40d74d6f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QLibrary: simplify qt_debug_component()Marc Mutz2014-09-121-4/+1
| | | | | | | | | | | | | | | Instead of initializing debug_env to -1 (thus forcing the variable into the data segment), and then overwriting the -1 with a read from the env-var, dynamically initialize the variable from the env-var directly, thus allowing the variable back into the bss segment (which doesn't occupy storage in the executable). There may have been a reason to do it this way when the old code could fail due to the memory allocation involved, but now with qEnvironmentVariableIntValue(), that is no longer a reason. Change-Id: I9f21b0783ff348f50b574395fc07f2869a14102e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QLibrary: use qEnvironmentVariableIntValue()Marc Mutz2014-09-121-1/+1
| | | | | | | | It doesn't allocate memory, so cannot throw and is a lot faster than qgetenv(). Change-Id: I8d440619edfbd90045564e1f92676f1e1f87e136 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add qEnvironmentVariableIntValue()Marc Mutz2014-09-122-0/+49
| | | | | | | | | | | | | | A lot of code in Qt uses VAR=1 for enabling or disabling some feature or other, ignoring qEnvironmentVariableIsSet(), which was added for that purpose. Other code actually reads numerical values from environment variables. For both use-cases, provide a non-throwing, non-memory-allocating way to get the numerical (int) value of an environment variable, complementing qEnvironmentVariableIs{Set,Empty}(). [ChangeLog][QtCore] Added qEnvironmentVariableIntValue(). Change-Id: I81c85287ea10d355c1bbf8d7807ec9a0e477bce0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QTextStream: add fast path for writing char and QChar.David Faure2014-09-122-2/+30
| | | | | | | | | | | | Avoids allocating a QString for every char being written out. The benchmark went from 5.5 ms per iteration to 0.8 ms, and from 40 million instructions to 6 million. Found using Milian Wolff's heaptrack tool. Change-Id: I1784c47b944454bc947a607a22c39d249372ed55 Reviewed-by: Adam Majer <adamm@zombino.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Merge remote-tracking branch 'origin/5.4' into devOswald Buddenhagen2014-09-109-12/+34
|\ | | | | | | Change-Id: Id4997327cc01bd4bb397a463bdffbd15e80398ef
| * Fix typo in QMetaType documentation.Mitch Curtis2014-09-091-1/+1
| | | | | | | | | | Change-Id: I934b68978fb32a518ed7cf9b47f1600982f58f66 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
| * Bump Q_COMPILER_INITIALIZER_LISTS to GCC 4.5Adam Majer2014-09-061-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While GCC 4.4 has the required header, it is missing important typedefs requiring use of pointers instead. This is acceptable if only used in one or two places, but a quick search through the source code lists quite a few usages of const_iterator typedef. $ git grep -c initializer_list\<.\*\>::const_iterator src/corelib/global/qflags.h:2 src/corelib/json/qjsonarray.h:1 src/corelib/json/qjsonobject.h:1 src/corelib/tools/qhash.h:2 src/corelib/tools/qmap.h:2 src/corelib/tools/qset.h:1 The lesser-evil is to bump Q_COMPILER_INITIALIZER_LISTS to version GCC 4.5 and retain usage of required (by standard) initializer_list typedefs. Change-Id: I38d6fa0ef3dc7d958587b406d33e3e3a7378c026 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * QDateTimeParser: remove unused local variablesMaks Naumov2014-09-051-2/+0
| | | | | | | | | | Change-Id: Id78fde8a720961c448d1aa3983ad296974796fdf Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
| * Use expiry_date field to check for evaluation timespanKai Koehne2014-09-051-2/+4
| | | | | | | | | | | | | | | | | | Use the new dedicated field instead of just assuming that the evaluation timespan is buildtime + 30 days. Change-Id: Ibf4078f030ea609d823fe01889a106a5da345817 Reviewed-by: Janne Anttila <janne.anttila@digia.com> Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
| * Doc: QRect::isEmpty's documentation didn't match the code.David Faure2014-09-051-1/+1
| | | | | | | | | | | | | | | | | | The code says bool QRect::isValid() const { return x1 <= x2 && y1 <= y2; } so the documentation should say <= as well, rather than <. Change-Id: If52005879d2a758b5d1d64b552e6cd96341fae76 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
| * Fix endianness part of QSysInfo::buildAbi() stringAlex Trotsenko2014-09-041-3/+3
| | | | | | | | | | | | | | | | | | | | | | Both Q_LITTLE_ENDIAN and Q_BIG_ENDIAN macros are always defined on all architectures. So, byte order detection results in "little_endian" value for big endian systems. Test the system endianness in a right way, according to Q_BYTE_ORDER macro documentation. Change-Id: I5523f90567e78d679a3ff2902a8f5377ed39ceb1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * Make QElapsedTimer default to invalid (and now non-POD).Robin Burchell2014-09-033-2/+22
| | | | | | | | | | | | | | | | | | | | | | The practical uses of a POD QElapsedTimer are not really that clear, and the number of misuses of this API are quite high. Default the state to invalid to prevent against mistakes. [ChangeLog][QtCore][QElapsedTimer] Is no longer a POD. Change-Id: I267292acf2bfca7404e3e449dd04410441d7ce26 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | QEasingCurve: The setting order of properties should not matter.Jan Arve Saether2014-09-021-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | Previously, this failed because QEasingCurveFunction only had a linear behavior. The fix is to change that and let QEasingCurveFunction handle any of the simple "non-parametric easing" functions. Task-number: QTBUG-38686 Change-Id: I666d59e10ceb589dcc52956b16a6f0c259aebdad Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Remove the enum for specifying {In|Out|InOut|OutIn} subtypes.Jan Arve Saether2014-09-021-52/+30
| | | | | | | | | | | | | | | | | | Instead we can just use the QEasingCurve::Type enum. This reduces code size and should simplify the code a bit. Change-Id: I34eb62b7921634c91785c7b8c7c12741e6284fa1 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QRegularExpression: add overloads matching over a QStringRefGiuseppe D'Angelo2014-09-022-0/+64
| | | | | | | | | | | | | | | | [ChangeLog][QtCore][QRegularExpression] Support for matching using QStringRef as the subject's string type has been added. Change-Id: Idb956bbbdf4213f9ebe035db32cd37cf3370c6bc Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | QRegularExpression: take into account the subject's start position and offsetGiuseppe D'Angelo2014-09-021-24/+53
| | | | | | | | | | | | | | This will enable the matching over QStringRefs. Change-Id: I77729433d201982659a8c2aab939b2d15f1c8aca Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Merge remote-tracking branch 'origin/5.4' into devFrederik Gladhorn2014-09-0129-132/+370
|\| | | | | | | Change-Id: I2811ff0b9d4097f0be60ff16e9664a5060cff23e
| * Fix headercheck failure introduced by 67c83f329e7fb6fbf5d8e402f42Thiago Macieira2014-08-301-0/+4
| | | | | | | | | | | | | | | | | | That commit exposed part of qfunctions_winrt.h for non-WinRT use (Windows 8) without wrapping with Q_OS_WIN. That meant the headercheck pass failed to compile when outside of Windows. Change-Id: Ie731cce21e5102f5e5879b147b7738a7d0a91ecd Reviewed-by: Andrew Knight <andrew.knight@digia.com>
| * Doc: Fixed typo "lamda".Jerome Pasion2014-08-301-1/+1
| | | | | | | | | | | | Change-Id: I17a3b324927407b64cabc39a0b90f0ab2e0676be Reviewed-by: Martin Smith <martin.smith@digia.com> Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
| * Fix nativeRead() for maxlen greater than UINT_MAXLars Knoll2014-08-291-4/+4
| | | | | | | | | | | | | | | | | | | | Don't truncate the maxlen to a DWORD. Instead read all data incrementally up t maxlen. Task-number: QTBUG-27796 Change-Id: I21c34d11046f1106244dcd77420cc472e7240e68 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * Doc: properties, add missing parenthesisSamuel Gaist2014-08-281-1/+1
| | | | | | | | | | Change-Id: I97b5a96b29416ca7af145edb1a6a96595c9524da Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
| * Mark QByteArrayList as metatype built-in type.Jędrzej Nowacki2014-08-285-3/+25
| | | | | | | | | | | | | | As a side effects it also adds core templates types to the tests Change-Id: I0e3338e0bffdf21982aa83d404c83288e54411f4 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
| * Micro-optimize QVector::count()Marc Mutz2014-08-281-1/+3
| | | | | | | | | | | | | | | | | | | | | | ...by instantiating std::count() not with QVector::const_iterator, which is a class, but with const T*, thus increasing the chance that the instantiation can be shared with other instantiations in the executable. It might also enable STL implementations to choose a hand-optimized version of the algorithm for C++ builtin types. Change-Id: I93df4e58f76838d98b565f229c19e317774b7b4c Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
| * QList: check d for equality before d->size for inequalityMarc Mutz2014-08-281-2/+2
| | | | | | | | | | | | | | Same change as was already applied to QVector::operator==(). Change-Id: Ic2e140a52ee95f2e215668077951de0b4450d194 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
| * QVector: check d for equality before d->size for inequalityMarc Mutz2014-08-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Assuming the CPU has already loaded 'this', the value of 'd' is just an indirect load away. The value of d->size, however, is two indirect loads away, one of which is the load of 'd'. So it makes more sense to check for d-pointer equality first, as that can proceed in parallel with the fetch for d->size, which the CPU may speculatively trigger. In addition, at least GCC in release mode after this change doesn't set up the stack frame if the d-pointer check succeeds. Change-Id: I61f9b245070dd1742fca6ccb8d4936a0b1aa7c07 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
| * Doc: language corrections QStorageInfo classNico Vertriest2014-08-271-55/+55
| | | | | | | | | | | | | | Task-number: QTBUG-40984 Change-Id: Idf8c6ecedb25f6c55b3fe8db69e6de9d9f2eaf74 Reviewed-by: Topi Reiniö <topi.reinio@digia.com> Reviewed-by: Martin Smith <martin.smith@digia.com>
| * Add operator-> to QJson iteratorsAllan Sandfeld Jensen2014-08-255-7/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | The iterators for QJsonArray and QJsonObject are currently lacking an operator-> definition. Unfortunately it is not possible to do in clean way without redefining either the iterators or QJsonValueRef class. This patch instead adds two fake pointer classes that are only used to handle the operator-> return value. Task-number: QTBUG-29573 Change-Id: Ief785a6afbbedc9e89cf3b6f3958c2c755997a66 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Use std::vector range ctor in QVector::toStdVector()Marc Mutz2014-08-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are three reasons to do so: 1. This could be more efficient, depending on the STL implementation. 2. By using QTypedArrayData iterators (T*) instead of QVector ones, we actually invoke the non-templated range ctor of std::vector, at least in the common case that std::vector<T>::const_iterator is also const T*. 3. The change turns a former NRVO return into a RVO one, potentially allowing more compilers to perform the copy elision. Change-Id: I70b35aaeae70ba06a971a36b8b1b1da997e8094f Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
| * Incorporate fixes from QQmlAnimationTimer into QAnimationTimer.Michael Brasser2014-08-221-16/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Incorporates animation timer fixes in: * 7da483bfbefcaabb1dbbf3e2f1d5b5f7aadc3b06 * b02eeeee586abe343b8866385c1327ac009b3ef0 * 59d5c5cf555a51cd7559cea197a198ef3a792614 from qtdeclarative. With these changes, we no longer need to call updateAnimationTimers in QUnifiedTimer::startTimers. Change-Id: Ic24501cfdc3cb572bd891d84f684f11c3bef1b50 Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
| * Tighten Q_OS_WINRT ifdefs in qfunctions_winrt.hAndrew Knight2014-08-211-3/+4
| | | | | | | | | | | | | | | | This allows the convenience macros to be used on desktop Windows 8 when interacting with Windows Runtime types. Change-Id: I09c6b18a6ee9711371ef7dc23fb1d3354198db1c Reviewed-by: Maurice Kalinowski <maurice.kalinowski@digia.com>
| * QTextCodec::codecForHtml looks at the first 1024 bytesShawn Rutledge2014-08-211-1/+1
| | | | | | | | | | | | | | | | The HTML 5 spec requires it, instead of only looking at the first 512. Task-number: QTBUG-40383 Change-Id: Ie10cf8c745ed1a3402914e126a02bc43d5035fff Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
| * Debug logging support for QNativeGestureEventShawn Rutledge2014-08-212-0/+2
| | | | | | | | | | | | | | | | | | | | The most useful information is what kind of gesture the event represents, but it was missing until now. Also added a line of documentation about the NativeGesture event type. Change-Id: I1ba3c951dcc5751e937d762d9b647ab0bf8d93b8 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
| * Rework how animationsystem interoperate with an animation driver.Gunnar Sletta2014-08-203-38/+95
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We need to keep track of both wall time which are used for pauses and actual animation driver time which is used for actual animations. When switching between these, we need to also maintain the temporal drift potentially introduced by the driver and also the time that has passed in wall-time from when a pause has started until an action animation takes over. This change introduces a well defined elapsed() function in QUnifiedTimer which will return the right value based on which mode we are currently in. It also introduces start/stopAnimationDriver functions which helps us maintain the temporal drift and pause-delta. Change-Id: I5b5100432a6db444a413d1bca4f2d5f800e8cf3e Reviewed-by: Michael Brasser <michael.brasser@live.com>
| * Restore foreach macro for GCC 4.3 and 4.4 in C++11 modeThiago Macieira2014-08-191-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | In C++98, typename can only be used for argument-dependent types and that's not the case here. This was tracked as language defect 382 and was fixed in the final C++11 standard, but the fix didn't make it to GCC 4.3 and 4.4 (which do have decltype). qthreadpool.cpp:274: error: using 'typename' outside of template Task-number: QTBUG-40783 Change-Id: I0eb702b33d2e8c95284f52841b0021dbfc743874 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
| * WinRT: Do not forget the path specificationMaurice Kalinowski2014-08-191-1/+1
| | | | | | | | | | | | | | | | The path value can be used to access any container or subcontainer in the settings, even if it is not created by Qt. Change-Id: I431d8a8b129dafb4ec85227421dc37ec76c18ecf Reviewed-by: Andrew Knight <andrew.knight@digia.com>
| * Merge "Merge remote-tracking branch 'origin/5.3' into 5.4" into refs/staging/5.4Giuseppe D'Angelo2014-08-194-12/+100
| |\
| | * Merge remote-tracking branch 'origin/5.3' into 5.4Frederik Gladhorn2014-08-124-12/+100
| | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Manually included changes from 3a347a4e70e5a10ee92dd2578316c926a399e894 in src/opengl/qgl.cpp. Conflicts: src/opengl/qgl_qpa.cpp src/plugins/platforms/android/androidjnimain.cpp Change-Id: Ic26b58ee587d4884c9d0fba45c5a94b5a45ee929
| | | * Fix disconnect()ing from signals declared in a base classOlivier Goffart2014-08-111-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix disconnection from pointer to member signal that belongs to the base class, but whose type is a pointer to a member of the derived class. Commit 9cc106d9d7d951fcf30f4b0f8606afa6b50892ec fixed connect, so apply the same fix in disconnect [ChangeLog][QtCore][QObject] Fixed disconnecting from pointer to member signal that belongs in the base class but whose type is explicitly given as a pointer to a member in the derived class Task-number: QTBUG-40638 Change-Id: Ia546fc8f36e1ea0dd0645bdd820aea47f43677ac Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| | | * Document missing QLatin1String methodsThiago Macieira2014-08-071-0/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Most of them were added before 5.0, but it's ok to just list as 5.0. Change-Id: I6e83a210a0165659f710d47ed595e9e89d5dbac9 Reviewed-by: Martin Smith <martin.smith@digia.com>
| | | * Android: Fix recursion bug in callStaticMethod()Christian Strømme2014-08-061-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | calling callStaticMethod() with template type jlong, jdouble or jboolean would cause the call to loop indefinitely. Change-Id: I99caa576e761fdef623ece04e0779e4cf2535592 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
| | | * Undo: Fix state entry bug for parallel state groupsPeter Kümmel2014-08-061-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit reverts c4cef6fae9f2a55f21fc9517855dfcf659c89081. The above fix for QTBUG-25958 (cloned in QTBUG-40219) is not complete and introduces the regression QTBUG-30049. Task-number: QTBUG-30049, QTBUG-25958, QTBUG-40219 Change-Id: I3c4b774dce06c13cb4e089f8413a7747cedfd212 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | | QString:add (last)indexOf overload with QRegularExpressionMatch outputSamuel Gaist2014-08-273-5/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds indexOf and lastIndexOf with QRegularExpressionMatch output overloads to QString. This allows to get the match corresponding to the index returned. [ChangeLog][QtCore][QString] Added support for retrieving the QRegularExpressionMatch to indexOf and lastIndexOf. Change-Id: Ia0ae2d3ff78864c7053ffa397874aca1d2b1c35c Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | | | Refactor QString::contains(QRegularExpression)Giuseppe D'Angelo2014-08-241-8/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unify the code of the two overloads; fix a typo in a warning; and use an opportunity to insert a move. Change-Id: I85eef86d35f0d1e2da25f09d92204e32abf6d7d3 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | | | QString: replace an inefficient QList with QVectorMarc Mutz2014-08-191-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | qt_section_chunk s larger than a pointer and wasn't marked as movable, so holding it in a QList is horribly inefficient. Change-Id: I32162b4960d32674a1f3b05bc24ac8813f16638d Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>