summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel
Commit message (Collapse)AuthorAgeFilesLines
* QMetaMethod: use new comparison helper macrosTatiana Borisova25 hours2-8/+11
| | | | | | | | | | Replace public friend operators operator==(), operator!=() of QMetaMethod to friend method comparesEqual() and Q_DECLARE_EQUALITY_COMPARABLE macro. Task-number: QTBUG-120304 Change-Id: Idb3f880a1db4850d73a58ed37f8cbd3454dd5ea2 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* QMetaSequence and QMetaAssociation: use new comparison helper macrosTatiana Borisova26 hours2-26/+21
| | | | | | | | | | | Replace public friend operators operator==(), operator!=() of QMetaSequence and QMetaAssociation classes to friend methods comparesEqual() and Q_DECLARE_EQUALITY_COMPARABLE macroses. Task-number: QTBUG-120304 Change-Id: I88e9b228220d36092437bfb71ae2f053d2e99fdf Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Don't quit automatically via QEventLoopLocker if there are open windowsTor Arne Vestbø32 hours2-2/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As part of df359bcb703db5a8adbf14e88ba4ae0d54f0cfcd the semantics and interaction between QEventLoopLocker and QGuiApplication was changed, based on the assumption that these two mechanisms were independent and should not affect each other. This had a surprising regression where the use of QEventLoopLocker in combination with the QCoreApplication::isQuitLockEnabled() automatic quit would end up quitting the app, even if it had open windows, for example when the last job of some internal job queue finished. It could be argued that if the app has open windows that should not be closed, they should ignore the Close event, and that an application with running QEventLoopLocker jobs should maintain an active window showing the progress of those jobs, but still, this is regression that we want to fix. We now bail out if !lastWindowClosed() in QGuiApplication's canQuitAutomatically, which is triggered from QEventLoopLocker's isQuitLockEnabled() behavior. And we do so regardless of whether quitOnLastWindowClosed is set or not, as the latter property determines the behavior when closing a window, not the behavior when a QEventLoopLocker goes out of scope. Similarly, we now block quitting of the application when triggered by quitOnLastWindowClosed() if a QEventLoop is active, regardless of the isQuitLockEnabled(), as the latter property is determining whether we should trigger a quit, not whether we should block them. [ChangeLog][Important behavior changes] Fixed a regression where the last QEventLoopLocker going out of scope would quit the app, even if there were open windows, if quitOnLastWindowClosed was false. [ChangeLog][Important behavior changes] Fixed a regression where closing the last window would quit the app, even if there were active QEventLoopLockers, if isQuitLockEnabled was false. Fixes: QTBUG-124386 Pick-to: 6.7 6.5 Change-Id: I84fd0ddea78a2f417f3a17b326113c880079cf85 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QTimer/QObject::startTimer: improve the detection of overflowThiago Macieira3 days3-4/+21
| | | | | | | | | | | | | | | | | | | | | | Converting from int milliseconds to int64_t nanoseconds can't overflow (it won't even for picoseconds, so we'll be fine for a couple more decades), so we only need to address the cases where the millisecond value was passed in int64_t: that is, in the std::chrono::milliseconds overloads. For the other cases, I added a comment. Amends bfc7535a10f7a6e3723f354b41f08a0fe1d18719 to not allow the detected overflow to happen at all, which could cause the timer to become very small. Instead, we saturate to the maximum, which is about 292 years (just under 106752 days). That's longer than computers have existed, so the chance that some Qt application is still running on a computer without any reboots from today to 24th century is remote at best. This parallels QDeadlineTimer, which already has code to saturate when using milliseconds. Change-Id: I6818d78a57394e37857bfffd17b9b1465b6a5d19 Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* QThread: Introduce static isMainThread() helperJarek Kobus4 days2-0/+2
| | | | | | | | | | | | Useful for QtCreator, as a replacement for Utils::isMainThread() inside threadutils.h, may serve for other projects, too. Introduce static QCoreApplicationPrivate::theMainThreadId atomic helper field holding the id of the main thread. Change-Id: Iccc0302f423f47b5ecad86c4cd3de4d1ee36155f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QMimeData: fix setData on URI list without ending CRLFThiago Macieira8 days1-0/+5
| | | | | | | | | | | | | Commit 8d127c57376e48dd49afe62cfb8e714d26759a69 refactored this code from QByteArray::split to manually iterate over the list (and QStringTokenizer doesn't work for QByteArray), so we missed the last element in the iteration. Pick-to: 6.7 Fixes: QTBUG-124580 Change-Id: I455fe22ef4ad4b2f9b01fffd17c867f6ed350af7 Reviewed-by: Ahmad Samir <a.samirh78@gmail.com> Reviewed-by: David Faure <david.faure@kdab.com>
* wasm: back out of calling onLoaded at first frameMorten Sørvig8 days1-4/+5
| | | | | | | | | | | | | | | Qt and application code expects that QScreen geometry should be available early in main(), after the QApplication constructor returns. This is not the case if onLoaded is called at later point in time, since the container element for the screen is typically made visible when onLoaded is called, and does not have valid geometry before. Change-Id: I62d87f01fce1cd601e7a70d842e22a61814c9db7 Reviewed-by: Even Oscar Andersen <even.oscar.andersen@qt.io> Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
* QMetaTypeCustomRegistry: use QHash::removeIf() instead of a custom erasing loopVladimir Belyavsky10 days1-7/+1
| | | | | | | | | | | | | | Use QHash::removeIf() instead of a custom erasing loop on aliases table when unregister custom type. It will still always detach even if nothing needs to be removed, since QHash::removeIf() always detaches. But this can potentially be fixed in the future, so it will be improved indirectly. Besides other things this also silences Clazy's "mixing iterators" warning. Change-Id: I3d6e8b0ed7dc10807570a0b0feac7eda6a0e572a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove unused includes in qmetatype.cppVladimir Belyavsky10 days1-2/+1
| | | | | | | | - Remove unused <bitset> - Place <qobject.h> under !(QT_BOOTSTRAPPED), because it seems used only there Change-Id: Ic77c7441d2400cf32e7b6ca2b90a1984a0b6377a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix documentation of QAndroidApplication::contextVolker Hilsheimer11 days1-1/+1
| | | | | | | | | | | | As of Qt 6.7 we no longer return jobjects from that API. The declared QJniType::Context type (and similar types) is no longer jobject-like, they are now QJniObject-like. Task-number: QTBUG-123900 Pick-to: 6.7 Change-Id: I215f84ac37907ae2b7950c40c7287590234e4e35 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
* QSystemError: add a couple of utility methodsAhmad Samir11 days1-0/+7
| | | | | | | | Change-Id: Ic7a44d264a01b2ca3f0899f5dad483482153c0c9 Reviewed-by: Rym Bouabid <rym.bouabid@qt.io> Reviewed-by: Yuhang Zhao <yuhangzhao@deepin.org> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QMetaType: allow converting to/from QChar and char16_tThiago Macieira12 days1-0/+3
| | | | | | | | Converting from char16_t to QString was already possible, going through a QChar. Change-Id: Ie28eadac333c4bcd8c08fffd17c5a41488ea5ba6 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QMetaType: add conversion from charXX_t to QStringThiago Macieira12 days1-0/+10
| | | | | Change-Id: I3c79b7e08fa346988dfefffd171f9c97384af5d0 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QDeadlineTimer: use new comparison helper macrosTatiana Borisova12 days2-29/+30
| | | | | | | | | | | Replace public friend operators operator==() and operator!=() of QDeadlineTimer to friend method comparesEqual(). Replace public friends operator<(),<=(),>(), etc of QDeadlineTimer to friend method compareThreeWay(). Task-number: QTBUG-120304 Change-Id: Ib855ccac9b31b54fe28b822f2985154608fefa27 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* QSignalMapper: change to use QObject::connect PMF syntaxJuha Vuolle13 days2-9/+3
| | | | | | Task-number: QTBUG-122619 Change-Id: I148e4ec77d16f62015c19c641b181e653219d132 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Add preliminary support for Qt for visionOSTor Arne Vestbø13 days1-0/+3
| | | | | | | | | | | | | | | | | | | | | | Qt already runs on Vision Pro as "Designed for iPad", using Qt for iOS. This change enables building Qt for visionOS directly, which opens the door to visionOS specific APIs and use-cases such as volumes and immersive spaces. The platform removes some APIs we depend on, notably UIScreen, so some code paths have been disabled or mocked to get something up and running. As our current window management approach on UIKit platforms depends on UIWindow and UIScreen there is currently no way to bring up QWindows. This will improve once we refactor our window management to use window scenes. To configure for visionOS, pass -platform macx-visionos-clang, and optionally add -sdk xrsimulator to build for the simulator. Change-Id: I4eda55fc3fd06e12d30a188928487cf68940ee07 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* QtCore: avoid unnecessary export in static buildZhao Yuhang2024-04-061-1/+5
| | | | | | | | | | | We only need it to be exported in shared builds. Without this change, there will always be an exported symbol called "qt_startup_hook" for executables that linked against QtCore statically, this is absolutely not the Qt user would expect. Change-Id: Icf19df09531e13184ea019aa708d6b93fa626f85 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Revert "wasm: Proxy emscripten_fetch() to the main thread"Piotr Wierciński2024-04-051-1/+1
| | | | | | | | | | | | This reverts commit f2f2b6ef18907a76461b54e110618e7840971fa7. Reason for revert: There are couple of issues introduced. Lets revert to base revision and go with fixes from there. Pick-to: 6.5 6.6 6.7 Change-Id: I8341de42ef3e4a609bfbffdb763dd5c28794473c Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Even Oscar Andersen <even.oscar.andersen@qt.io>
* JNI: check for pending exception first in getCleanJniObject()Assam Boudjelthia2024-04-041-5/+3
| | | | | | | | | | | | | returning early if the object is null will not clear pending exceptions from the previous failed JNI call, and that will crash the app on the next jni call if an explicit exception clearing is not done, wish mostly the case. Checking and clearing for exceptions has to always be done under this call. Pick-to: 6.7 Fixes: QTBUG-122135 Change-Id: I0d42d012a4d1305fa07147fd22860d7c005f9b83 Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* Qt::ApplicationAttribute: static_assert that we don't go higher than 32Mitch Curtis2024-04-041-1/+4
| | | | | | | | Because we can't support it on 32 bit operating systems. Task-number: QTBUG-69558 Change-Id: I406ecccdf039d7d4f4c24268c92c91e367655cba Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QObject: add check for Q_OBJECT macro to findChild(ren)Thiago Macieira2024-04-031-0/+6
| | | | | | | | | | | | | | | | | We can't fix the underlying reported problem, but we can warn that the user has made a mistake. [ChangeLog][QtCore][QObject] The class template parameter passed to QObject::findChild() or findChildren() is now required to have the Q_OBJECT macro. Forgetting to add it could result in finding children of the nearest ancestor class that has the macro. Pick-to: 6.7 Fixes: QTBUG-105023 Change-Id: I5f663c2f9f4149af84fefffd17c008f027241b56 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QMetaMethod: document that fromSignal(nullptr) is okMarc Mutz2024-03-211-1/+1
| | | | | | | | | ... and add a test. Pick-to: 6.7 6.6 6.5 6.2 5.15 Change-Id: I907899d7c54349d2fc23ea5ab58a1e67826b622b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QTest::qWaitFor(., int): remove superfluous static keywordMarc Mutz2024-03-211-1/+1
| | | | | | | | | | | | | The static keyword prevents the linker from reusing the executable code of one TU's instantiation of this function in other TUs. There's no reason for this restriction, so remove it. Amends 292cb12e024e63f17c501611e021b6f8da7d6dcc. Pick-to: 6.7 Change-Id: Ide60ce0bf4b7118295fad98a25bd438fc1da2039 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QObjectPrivate::Signal: initialize all membersMarc Mutz2024-03-201-1/+1
| | | | | | | | | | | | | | | | A recent change in that area triggered Clang-SA to rescan the code and complain about this pre-existing bug: If receiver == nullptr, then the `previous` member was never initialized. Fix by null'ing it using NSDMI. This is a trivial type, the compiler will be able to avoid the redundant write. Amends ab92b9e40025dcf08c14232de762a268201a78b4(!). Pick-to: 6.7 6.6 6.5 6.2 5.15 Change-Id: Ideed71f0f36d5f896fb6a4614f233757c1371ee3 Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QObjectPrivate: fix data race on ConnectionData contentsDavid Faure2024-03-192-22/+29
| | | | | | | | | | | | | The atomic pointer "connections" is always populated under mutex in QObjectPrivate::ensureConnectionData() but isn't necessarily read under mutex protection (e.g. in maybeSignalConnected()). This caused a data race, fixed by using storeRelease and loadAcquired. Task-number: QTBUG-100336 Pick-to: 6.7 6.6 6.5 Change-Id: Ifd605e65122248eb08f49e036fdda6e6564226bc Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QProperty: Use RefCounted as intendedUlf Hermann2024-03-192-6/+10
| | | | | | | | You're not supposed to mess with the refcount directly. That's what the addRef() and deref() methods are for. Change-Id: I5cae946cef7ac72dd99b247ade95590d142c269e Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QProperty: Destroy binding when refcount is 0Ulf Hermann2024-03-182-9/+16
| | | | | | | | | | This has to be done from all places where we deref it. Otherwise we leak memory. Pick-to: 6.7 6.6 6.5 Fixes: QTBUG-116086 Change-Id: I57307ac746205578a920d2bb1e159b66ebd9b2cc Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QTest::qWaitFor: scope std::chrono using directive tighterMarc Mutz2024-03-151-2/+2
| | | | | | | | | | ... moving it away from between a comment and the C++ code the comment pertains to. Pick-to: 6.7 Change-Id: I56b3ded01d1800bae19121e4b9340d0c43f1da85 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* QTest::qWaitFor: move ceil<> to after the checkMarc Mutz2024-03-151-4/+2
| | | | | | | | | | | | | | | | | There's no reason to check whether the timer has expired after rounding the timer's native nanoseconds up to milliseconds, so delay the ceil<ms> operation to after the timer expiry check. As a drive-by, protect the std::min call from Windows macros with the parentheses trick and employ C++17 if-with-initializer. Remove the break-if-expired, as it now obviously duplicates the while exit condition. Pick-to: 6.7 Change-Id: If30421012143640c75a9a44fe711d0c1c7cd23b9 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* wasm: Dont access QNetworkReply header data through dangling pointerPiotr Wierciński2024-03-141-1/+1
| | | | | | | Fixes: QTBUG-122893 Pick-to: 6.5 6.6 6.7 Change-Id: I3768fdffaec7be4ec0b559fdb365600220e648d1 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* QTest::qWaitFor: remove superfluous check for isForever()Marc Mutz2024-03-141-5/+0
| | | | | | | | | | | | | | | | | | | When a QDeadLineTimer::isForever() then its remainingTime() is chrono::nanoseconds::max(), which is exactly representable as chrono::milliseconds, and greater than 10ms, so the following code would have done the right thing already. Let it. This also removes the duplicate mentioning of the 10ms sleeping timeslice. Amends fa296ee1dcf4c16fb6f242cf08949485e499fec3. Pick-to: 6.7 Change-Id: Ibc32d6069b78cd4583df07d0707d98645440b36c Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QTest: add missing <chrono> to qtestsupport_core.hMarc Mutz2024-03-141-0/+2
| | | | | | | | | Don't rely on transitive includes. Pick-to: 6.7 Change-Id: I350922a47842ad5bdad0dc3f8349b0c82dd4bd0d Reviewed-by: Ahmad Samir <a.samirh78@gmail.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QTest::qWaitFor: make a comment terserMarc Mutz2024-03-141-3/+2
| | | | | | | | | | ...and adjust it to its presence in the new QDeadlineTimer overload, which sports nanoseconds granularity. Pick-to: 6.7 Change-Id: Ifa9658ca32c5dc4bef5cf36dec2e452174eebe1c Reviewed-by: Ahmad Samir <a.samirh78@gmail.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QTest::qWaitFor: remove superfluous qthread.h includeMarc Mutz2024-03-141-1/+0
| | | | | | | | | Amends 1abea5f5f13b4b8ec2a1c282e643b791cea12f30. Pick-to: 6.7 Change-Id: Ic4be7ed9508ae07eaa0f1d618090c8f44bb431fc Reviewed-by: Ahmad Samir <a.samirh78@gmail.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QTest::qWaitFor: scope a variable tighterMarc Mutz2024-03-141-2/+1
| | | | | | | | | | | | | | | | When fa296ee1dcf4c16fb6f242cf08949485e499fec3 ported this function from int timeout to QDeadlineTimer, the need to keep this variable outside the do-while so it could be checked in the loop exit condition fell away. Moving the definition of the variable to the first (and only) assignment makes the code clearer and the variable a constant. Amends fa296ee1dcf4c16fb6f242cf08949485e499fec3. Pick-to: 6.7 Change-Id: I7a0fe01dc68ff140beeb0e76b141c84d4bd28458 Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* Remove QObjectPrivate::isSender/senderList, no longer usedDavid Faure2024-03-142-36/+0
| | | | | | | | | Only QAccessibleWidget was using them, and this was changed some time ago. No point in keeping dead code. Change-Id: I14bc40e6d87df234987e82385ce13433c2b82744 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QSingleShotTimer: use the Duration alias from the event dispatcherThiago Macieira2024-03-131-7/+10
| | | | | | | | Just so we don't accidentally use different precisions. Amends commit bfc7535a10f7a6e3723f354b41f08a0fe1d18719. Change-Id: I83dda2d36c904517b3c0fffd17b5258e88dd194e Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* QEventDispatcher*: port the Unix dispatchers to V2Thiago Macieira2024-03-1310-116/+111
| | | | | | | | | | | They're all ported in one go because all the changes are the same and they all rely on QTimerInfoList. The changes are: - use Qt::TimerId to uniquely identify timer IDs - use Duration (nanoseconds) to specify the timer interval - rename registeredTimers() to timersForObject(), which is const Change-Id: I83dda2d36c904517b3c0fffd17b52958767d8a68 Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* QTimerInfo: store nanoseconds instead of millisecondsThiago Macieira2024-03-135-30/+39
| | | | | | | | | | | | | | No change in behavior, other than the ability for the precise timers to be even more precise. There's a reduction in the stored interval range from 292 million years to 292 years, but there's no change in behavior because the timeout is stored as a steady_clock::time_point, which is nanoseconds with libstdc++ and libc++. Now, if there's an overflow, it'll happen on the call to registerTimer() instead of inside the calculation of the wake-up. Change-Id: I83dda2d36c904517b3c0fffd17b3d1f2d9505c1c Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* QAbstractEventDispatcher: port timer uses to the V2 APIThiago Macieira2024-03-134-10/+11
| | | | | | Change-Id: I83dda2d36c904517b3c0fffd17b52b71739928dc Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* QTimerInfo: correct CoarseTimer beyond the [20ms,20s] range earlierThiago Macieira2024-03-131-18/+16
| | | | | | | | Simplifies some code. Pick-to: 6.7 Change-Id: I83dda2d36c904517b3c0fffd17b3d18f2dfbc2b3 Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* QAbstractEventDispatcher: add an adaptation layer to use V2 methodsThiago Macieira2024-03-132-0/+49
| | | | | | | | This way, we can begin using the V2 methods now, regardless of whether the concrete dispatcher class has been ported or not. Change-Id: I83dda2d36c904517b3c0fffd17b52a6256b083af Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* Short-live QAbstractEventDispatcherV2Thiago Macieira2024-03-133-13/+279
| | | | | | | | | | | | | | | | | | | | | | | | | | | This class is a temporary hack to enable transition to an API based on std::chrono for the Qt event dispatcher. In Qt 7, it will be merged with QAbstractEventDispatcher, replacing the pure virtuals there with the ones defined here. The new API differs from V1 in the following ways: - uses Qt::TimerId instead of int to identify timer IDs, so we can't accidentally confuse them with something else - uses Duration (nanoseconds) to specify the interval, instead of a mix of int and qint64 - add the missing const to remainingTime() - rename registeredTimers() to timersForObject() (I'd have kept the original name but we can't overload the name if the parameters are exactly the same; we could have used QT6_DECL_NEW_OVERLOAD_TAIL, but I think the new name is actually better) Because the old API was mixing int and qint64, we didn't officially support any timer for more than 2^31 ms (~24.85 days). This should extend the valid range to 292 years once the dispatchers are ported over. Change-Id: I83dda2d36c904517b3c0fffd17b3a7e0afef4b59 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* QTest::qWaitFor(., int): restore lost Qt::PreciseTimer'nessMarc Mutz2024-03-131-1/+1
| | | | | | | | | | | | | | | | | Before the qWaitFor() port from int to QDeadlineTimer, the implementation constructed a QDeadlineTimer internally, passing int timeout and Qt::PreciseTimer. The int overload that was retained for source-compatibility, however, constructs the QDeadlineTimer without the PreciseTimer flag, which is a behavior change. Restore the Qt 6.6 behavior and pass Qt::PreciseTimer. Amends fa296ee1dcf4c16fb6f242cf08949485e499fec3. Pick-to: 6.7 6.7.0 Change-Id: Ib8e5b912c74b70d32a77195edb0d2a30cd7c241d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Bootstrap: remove QVariantThiago Macieira2024-03-133-15/+40
| | | | | | | | | I added QT_NO_VARIANT to qconfig-bootstrapped.h to be clearer on what the #ifs are, but there's no testing of that feature outside of QT_BOOTSTRAPPED. Change-Id: I01ec3c774d9943adb903fffd17b7e8ac4340fb89 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Bootstrap: remove QDataStreamThiago Macieira2024-03-132-8/+11
| | | | | | | | | | | It was only used by the cmake_automoc_parser so it would write a 64-bit in big-endian format. So bypass QDataStream and write it native endianness. Change-Id: I01ec3c774d9943adb903fffd17b79c78e56db4cf Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* QVariant: use comparison helper macrosIvan Solovev2024-03-122-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | The relational operators were removed in 8652c79df0a47264a2d525424484e15744e2462b with the argument that they do not have a total order. Back than it was a valid argument, because Qt did not support any of the C++20 ordering types. Now Qt has its own implementation for all three ordering types, so we could technically add relational operators and claim that QVariant provides partial ordering. However, that could potentially lead to many bugs and/or unexpected results, if people start using QVariant as a key in std::map/QMap containers. We do not want that to happen, so we only use the helper macros to implement (in)equality operators. This commit also extends the unit tests, providing more extensive testing of (in)equality operators and the pre-existing QVariant::compare() method. Fixes: QTBUG-113234 Change-Id: I783f3b5df552da782627f4ed0a5bb1b577753a23 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QObject: fix a documentation note in the destructorGiuseppe D'Angelo2024-03-081-2/+2
| | | | | | | | | | | | | | | | | | | | | | | The docs for ~QObject say: > any pending posted events for the object are removed from the event > queue but then they also say: > Deleting a QObject while pending events are waiting to be delivered > can cause a crash These two contradict each other. In fact, the first one is correct, the second one is factually incorrect. Amend it to what I believe it's the intended meaning: do not destroy a QObject which is _handling_ an event (i.e. we're into QObject::event() or an override). Change-Id: Id1d564f296e17a764e0f49ebfedf6e292085c221 Pick-to: 6.7 6.6 6.5 6.2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Shantanu Tushar <shantanu.tushar@kdab.com> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* JNI: Fix error with overload resolution when passing string typesVolker Hilsheimer2024-03-061-1/+4
| | | | | | | | | | | | | | | | | | | | The variadic templates are supposed to be removed from the overload set when any of the parameters is a literal string type, as otherwise we get conflicts with the legacy overload taking class names and signatures as const char *. The detection of a literal string types was missing a few specializations, so that we ended up with the wrong overload being called, and class names getting interpreted as method names instead. Add the missing specializations, and add more test coverage for using the old overloads. Task-number: QTBUG-122235 Pick-to: 6.7 Change-Id: I5488f2009c8f62d74fac6754844f57cf64011414 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Rami Potinkara <rami.potinkara@qt.io> Reviewed-by: Lauri Pohjanheimo <lauri.pohjanheimo@qt.io>
* Revert "Fix export of QDeferredDeleteEvent, should be Q_CORE_EXPORT"Marc Mutz2024-03-051-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit bc3b18764aabf95a50a65e090863c54b6ac57e3e. Reason for revert: QDeferredDeleteEvent changed the size in 6.7. It is more important to protect the casual user that relied on the mention of the otherwise undocumented class in the QEvent::Type::DeferredDelete documentation than to be convenient for one tool, developed by experts who know how to replace their dynamic_cast with a type() check and a static_cast and/or extract information from an unexported class. In fact, not even the autotest-export is needed, as there are no mentions of the class outside of comments outside QtCore. Found in API-review. [ChangeLog][QtCore][QDeferredDeleteEvent] Made this undocumented class private and unexported. You will still be able to see the definition in qcoreevent_p.h, but you won't be able to create objects of the class anymore. Change-Id: I8a47c69d356a0bef260e7987bc4eab96430e8072 Pick-to: 6.7 Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>