summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2019-12-0919-197/+250
|\ | | | | | | Change-Id: Ia24cc8b86def0d9d9c17d6775cc519e491b860b1
| * QMetaType: add more static-less APIOlivier Goffart2019-12-072-2/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In prevision to Qt6 which is going to discourrage the use of the integer id, add some missing API to the staticless QMetaType API: - Add a way to construct a QMetaType from a type without calling qMetaTypeId: QMetaType::fromType<T>() - Add equality operators - Add a QMetaType::name() function - Add a default constructor (by adding a default parameter to the existing ctor) Change-Id: I95487c1c31bdf0d773717daa9d5452cbced30673 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
| * Tidy nullptr usageAllan Sandfeld Jensen2019-12-0618-198/+198
| | | | | | | | | | | | | | | | | | | | | | Move away from using 0 as pointer literal. Done using clang-tidy. This is not complete as run-clang-tidy can't handle all of qtbase in one go. Change-Id: I1076a21f32aac0dab078af6f175f7508145eece0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
| * Deprecate QVariant::operator< and related operatorsOlivier Goffart2019-12-052-4/+20
| | | | | | | | | | | | | | | | | | | | | | Since the operator does not have a total order, it is kind of pointless, and this is going to be removed in Qt6 Change-Id: I754be059726bf30993550a2d753f8b865f2d4a5f Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | Use the QByteArray::DataPointer typedef instead of QByteArrayDataLars Knoll2019-12-081-1/+0
| | | | | | | | | | | | | | | | The goal here is to move things over to QArrayDataPointer. This prepares for it. Change-Id: I32f54a47594274799600c618f7341c200ceaa306 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Enlarge QVariant's private to fit the new QString and QByteArrayThiago Macieira2019-12-081-1/+2
| | | | | | | | | | Change-Id: I8baecd0a4db13200b34cdd7c8aebc2a1cc0a0c75 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Inline the size and data pointers in QByteArrayThiago Macieira2019-12-081-1/+1
| | | | | | | | | | Change-Id: I82feeb2c9bd2900f421fc0c8d78698b1e83db043 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Change representation of string data in the meta objectLars Knoll2019-12-083-27/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | Don't store our string data as QByteArrayLiterals anymore, but revert back to simply storing them as an array of char* and offsets into that array. This is required to be able to inline size and begin into QByteArray itself. Once that change is done, we can then avoid creating copies of the string data again. Change-Id: I362a54581caefdb1b3da4a7ab922d37e2e63dc02 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Add reference-count manipulation functions to QArrayData and hide refThiago Macieira2019-12-081-1/+1
| | | | | | | | | | | | | | | | The next change will stop using some values in the reference counter as settings from the data. Change-Id: I94df1fe643896373fac2f000fff55bc7708fc807 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Introduce QArrayData::allocatedCapacity() and use it instead of d->allocThiago Macieira2019-12-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In almost all cases, use d->allocatedCapacity() or d->constAllocatedCapacity() instead of d->alloc, since they do the same thing (right now). In the future, the functions will be changed. There is a separate const version because most const code should not need to know the allocation size -- only mutating code should need to know that There are a few cases where d->alloc was replaced with a better alternative, like d->size. The one case that remains in the code will be replaced by a different test when it's available. Change-Id: I48135469db4caf150f82df93fff42d2309b23719 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Replace QArrayData::capacityReserved with a full flags fieldThiago Macieira2019-12-071-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | Instead of stealing one bit from the alloc field, let's use a full 32-bit for the flags. The first flag to be in the field is the CapacityReserved (even though the allocate() function will store some others there, not relevant for now). This is done in preparation for the need for more flags necessary anyway. Change-Id: I4c997d14743495e0d4558a6fb0a6042eb3d4975d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Use Q_NAMESPACE for the Qt namespace, and remove the old moc hack to support itOlivier Goffart2019-12-064-191/+235
| | | | | | | | | | | | | | | | | | | | Since I can't #include qobjectdefs from qnamespace because of circular dependency, move the Qt macro in the qtmetamacros.h header. Deprecate QObject::staticQtMetaObject since now one can just use Qt::staticMetaObject Change-Id: I11982aa17c2afa2067486b113f8052672f3695eb Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2019-12-051-2/+2
|\| | | | | | | Change-Id: I9d63a4c4b229a831b5369f6ec74ac97ba6d6556a
| * Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2019-12-041-2/+2
| |\ | | | | | | | | | Change-Id: Ia70e81943ef097941339f9ef9ace28592a2eb740
| | * Fix serializing QUuid with QDataStream with Qt 4 stream versionsJoni Poikelin2019-12-031-2/+2
| | | | | | | | | | | | | | | | | | | | | Fixes: QTBUG-76103 Change-Id: Iac92c33539940f5f67d014db5240c6dc14bfb772 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* | | Remove QVariant::operator< and related operatorOlivier Goffart2019-12-042-128/+0
| | | | | | | | | | | | | | | | | | | | | The operator does not have a total order Change-Id: Ifd263c3495aca08c8ccceb9949596c308a76a6c1 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2019-11-301-0/+3
|\| | | | | | | | | | | Change-Id: Icbb60f8c1891ec2779575276495199ace9d3d6c3
| * | Silence MSVC build of Qt for PythonFriedemann Kleint2019-11-291-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Enclose QAssociativeIterableImpl::advanceImpl within QT_WARNING_DISABLE_DEPRECATED, fixing numerous warnings: MSVC\14.23.28105\include\xutility(727): warning C4996: 'QHash<QString,QVariant>::const_iterator::operator --': was declared deprecated include\QtCore\../../src/corelib/tools/qhash.h(432): note: see declaration of 'QHash<QString,QVariant>::const_iterator::operator --' include\QtCore\../../src/corelib/kernel/qmetatype.h(1217): note: see reference to function template instantiation 'void std::advance<QHash<QString,QVariant>::const_iterator,int>(_InIt &,_Diff)' being compiled with [ _InIt=QHash<QString,QVariant>::const_iterator, _Diff=int ] include\QtCore\../../src/corelib/kernel/qmetatype.h(1253): note: see reference to function template instantiation 'void QtMetaTypePrivate::QAssociativeIterableImpl::advanceImpl<T>(void **,int)' being compiled with [T=QVariantHash] include\QtCore\../../src/corelib/kernel/qvariant.h(793): note: see reference to function template instantiation 'QtMetaTypePrivate::QAssociativeIterableImpl::QAssociativeIterableImpl<QVariantHash>(const T *)' being compiled with[T=QVariantHash] Amends dbb54805f63f9ed68d84fe090d608872f16170d2. Change-Id: Ieb875eaa943100ce1941cb1473b35892330c3889 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* | | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2019-11-2511-151/+171
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/tools/qhash.h src/gui/kernel/qevent.h src/widgets/kernel/qshortcut.cpp src/widgets/kernel/qshortcut.h Change-Id: If61c206ee43ad1d97f5b07f58ac93c4583ce5620
| * | wasm: add platform qsettingsLorn Potter2019-11-141-18/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since the backend is async, the settings will not be ready to read/write instantly as on other platforms, but only be ready after the filesystem has been synced to the sandbox. This takes at least 250 to 500 ms. The QSettings status() or isWritable() can be used to discern when the settings are ready for use. This also fixes a crash in threaded wasm Task-number: QTBUG-70002 Fixes: QTBUG-63923 Fixes: QTBUG-79650 Change-Id: If24c6ada1b91b2a565ed6733da74972c3027f622 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
| * | Make QObjectPrivate::threadData a proper atomicGiuseppe D'Angelo2019-11-1310-109/+148
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QObjectPrivate::threadData used to be a QThreadData *, and was read and written from multiple threads without proper synchronization. As an example, it was read from QCoreApplication::postEvent and written from QObject::moveToThread, therefore causing UB. Port threadData to a proper atomic, removing the races. Fix all usage points. In general, QObject is documented to be simply reentrant, not thread-safe, and certain bits (e.g. timers, moveToThread) are not even reentrant. The reasoning therefore is that a given QObject's threadData is not supposed to be touched by multiple threads without some synchronization happening elsewhere, and therefore relaxed loads should be sufficient. As drive-by change: refactor QCoreApplication::postEvent. It was particularly subtle, because it had a loop using a volatile to cope with the possibility of the receiver object switching thread while we tried to lock its thread's event queue. However, volatile does not achieve any synchronization, so drop it, and refactor the algorithm using better locking primitives. Put this algorithm in a common place, and also reuse it from removePostedEvents, which was lacking any synchronization. Change-Id: Icc755f7eb418ff54b33db4bdd87fd8eaf4e82c7a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * | QEventDispatcherWin32: unify input checks in {un}register...()Alex Trotsenko2019-11-131-18/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The event manager has a family of the functions for registering sockets notifiers, event notifiers, and timers. To ensure efficient debugging, it would be useful to have one approach regarding input parameters validation for the entire set of that functions. Based on registerSocketNotifier() implementation, this patch offers the same debugging principles for QWinEventNotifier and QTimer. Some debug messages have also been refined. Change-Id: I1418ef43c51f7b794462b5e9c8a849633e0c60f9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * | QBasicTimer: release timer id on exitAlex Trotsenko2019-11-131-6/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In some cases of inheritance, timer deletion can be triggered from the event dispatcher destructor where QThreadData::eventDispatcher is already nullptr. Despite the fact that the application is in shutdown phase, we should free the resource. Change-Id: I61ed1d817fd7638953f7d629823f19d4f6f1ee00 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Fix build without features.shortcutTasuku Suzuki2019-11-121-3/+0
| | | | | | | | | | | | | | | | | | Change-Id: I09a1e2e34df6ca1d779a7e36585f70a0d347cde5 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | | Fix up parts of the QList related docsLars Knoll2019-10-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | Remove the class docs for QList and make it point to QVector. Adjust containers documentation and replace QList with QVector in there. Change-Id: I37f712d91b21ad78e017faf9d71cac66f64440b0 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Fix all tst_qmetatype breakages after QList to QVector aliasingJędrzej Nowacki2019-10-302-0/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Qt6 QList is just a typedef to QVector. To keep Qt5 behavior compatibility we need to register aliases, otherwise some type name based operations would not work. The patch adds automatic registration of QList metatype alias for every QVector. The patch doesn't cover usage of already typedef'ed and aliased QList and QVector, but that should be quite esoteric, especially after introduction of automatic QList and QVector type registration. Change-Id: I84672dda2b159d94e76cdc6034861e7d7ef52533 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Make QList an alias to QVectorLars Knoll2019-10-303-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is almost 100% source compatible with Qt 5. Exceptions are * Stability of references for large or non movable types * taking a PMF for types that are now overloaded with r-value references in QVector * The missing prepend optimization in QVector (that is still planned to come for Qt 6) Change-Id: I96d44553304dd623def9c70d6fea8fa2fb0373b0 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Move QListSpecialMethods over to QVectorLars Knoll2019-10-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Extend QVector with special methods for QByteArray and QString, just as QList had them in Qt 5. This also means that QStringList and QByteArrayList are now implemented through a QVector, not a QList anymore. QListIterator<QString> is now slightly source incompatible as QStringList is a QVector, but that will be fixed in a follow-up change when QList<QString> will start mapping to a QVector. Change-Id: I7cfb8a72d4d95b347bbd386892f244b7203b41c2 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2019-10-301-0/+1
|\| | | | | | | | | | | Change-Id: I7f11733bda960196a96c6452bdabeb7072a8430d
| * | Add a getter for QObjectPrivate::threadDataGiuseppe D'Angelo2019-10-281-0/+1
| | | | | | | | | | | | | | | | | | | | | Strictly a temporary measure to deal with cross-module merges. Change-Id: I344bb3f20f68f04367041834e608669122ff70b1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Replace Q_ALIGNOF usage in qtbase with C++11 alignof keywordVolker Hilsheimer2019-10-292-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The macro is not documented, so not part of the public Qt API. It is made obsolete by the alignof keyword in C++11. Remove the usage of the macro across qtbase, in particular the workarounds for compilers that didn't support alignof, and that will not be supported in Qt 6. The macro definition is left in place, no need to break existing code. Task-number: QTBUG-76414 Change-Id: I1cfedcd4dd748128696cdfb546d97aae4f98c3da Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | | QShortcut: Properly port to the new configure systemFriedemann Kleint2019-10-253-4/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move the feature to corelib so that the QMetaType enumeration values can be properly excluded and there is no need for a dummy class. Use QT_REQUIRE_CONFIG in the headers of classes to be disabled. Add headers/source files in the .pro file depending on the configure feature in libraries and tests. Add the necessary exclusions and use QT_CONFIG. Task-number: QTBUG-76493 Change-Id: I02499ebee1a3d6d9a1e5afd02517beed5f4536b7 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2019-10-173-2/+213
|\| | | | | | | | | | | Change-Id: Ica69de99be9c8af4d28a52e4b69e6af748ed983c
| * | Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2019-10-163-2/+213
| |\| | | | | | | | | | Change-Id: Ifd83db69416230175ddc3161f640b612755018fc
| | * Win32: Consolidate registry codeFriedemann Kleint2019-10-143-2/+213
| | | | | | | | | | | | | | | | | | | | | | | | Add a RAII class for registry keys and use it throughout the code base. Change-Id: I666b2fbb790f83436443101d6bc1e3c0525e78df Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* | | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2019-10-121-24/+4
|\| | | | | | | | | | | Change-Id: I6ad865b2c26003f4508da9b3f8e075a951ff8ef7
| * | QObject: use delegate constructorsGiuseppe D'Angelo2019-10-111-23/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Avoid the massive code duplication in the two QObject constructors. The only slight difference is the code path checking for isWidget; I'd say that paying for that one is worth the price of de-duplicating. Change-Id: I3af749738fe7d6b7adf287009d1815396a2f1407 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
| * | Remove potential out of bounds accesses to QListLars Knoll2019-10-101-1/+3
| | | | | | | | | | | | | | | | | | Change-Id: I13431e45ef329921a8846c38047f704a299a1a94 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* | | Remove leftovers from QML1Lars Knoll2019-10-102-19/+2
| | | | | | | | | | | | | | | | | | | | | QML1 is not supported anymore, remove the leftover hooks for it. Change-Id: I2900726714c5faea3523b2ebe39bb393364b3bfb Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Add support for slots to receive the raw void ** arguments arrayLars Knoll2019-10-072-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is currently being used by dbus und our state machine framework, and supported by hand editing moc generated code. Get rid of that hack, and instead add support to moc to forward the raw arguments array to the slot. Change-Id: I0e36626f91eb01041464e6d931dc1d4660de91d2 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2019-10-062-2/+12
|\| | | | | | | | | | | Change-Id: Ife31dad3c8dc43c5ff4d266e6d646230c5d20a50
| * | Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2019-10-052-2/+12
| |\| | | | | | | | | | Change-Id: I554a2762890391b3b6013c8b82211a8386a4ced8
| | * Simplify creating QCFTypes from CFTypeRefsTor Arne Vestbø2019-10-041-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of forcing the user to cast: QCFType<CFFooRef> foo = (CFFooRef)CFFunctionReturningCFTypeRef()); We can do it for them, since we already know the expected type: auto foo = QCFType<CFFooRef>(CFFunctionReturningCFTypeRef)); Change-Id: I994d5d6530f220288b4bfd6ab16eae9f159ce3ef Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
| | * Add explicit QDebug stream operator for QCFStringTor Arne Vestbø2019-10-042-0/+7
| | | | | | | | | | | | | | | | | | | | | Disambiguates between the QString and CFStringRef overloads. Change-Id: I55a7121cd7449b4adc081f6bb7e29736e7af4442 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| | * macOS: Add missing export of QDebug stream operator for QMacAutoReleasePoolTor Arne Vestbø2019-10-041-1/+1
| | | | | | | | | | | | | | | | | | Change-Id: Id3e140bd91dcbf2683a41cd9ac36ff79b8f365b4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | | Get rid of QList forward declarationsLars Knoll2019-10-041-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | Include qcontainerfwd.h instead where required. This prepares for unifying QList and QVector. Change-Id: I6c85e2bdd44fb41aedd884b0d551f682760df5b5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Merge remote-tracking branch 'origin/5.15' into devLiang Qi2019-10-042-5/+12
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/network/access/qnetworkaccessmanager.cpp src/network/access/qnetworkreplyhttpimpl.cpp Change-Id: I059be651604623616fd31e8616be8ae61b4f8883
| * | Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2019-10-042-5/+12
| |\| | | | | | | | | | Change-Id: I43393cf47675fd6c14972df1221986335c6f493c
| | * Export lcEventDispatcher in private namespaceTor Arne Vestbø2019-10-032-5/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | The category is used outside of QtCore, and needs to be exported for shared library builds. Change-Id: I9bba477d37b823146eaec4e1e53197651f09c013 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2019-10-021-1/+1
|\| | | | | | | | | | | Change-Id: Ideaa64d583746f1ce8265997131fb1ce3a9acbcf