summaryrefslogtreecommitdiffstats
path: root/src/corelib
Commit message (Collapse)AuthorAgeFilesLines
* Fix warning, make sure temporary is moved into return valueVolker Hilsheimer2020-10-161-2/+2
| | | | | | | | Seen on clang 12; might be a compiler bug, but doesn't hurt either. Change-Id: I4aba8406c99951106e57fe9e61c688e649963cd6 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Q(E)SDP(V2): fill the API gap left by take()Giuseppe D'Angelo2020-10-163-2/+57
| | | | | | | | | | | | | | | | | | | | | | | | take() returns a pointer to the shared data object *without* decrementing the reference counter. The primary use case is adopting the object from a Q(E)SDP into a different reference counting mechanism. This is fine, but if we support the "extraction" part, we shall also support the "adoption" part. Also, the API for the shared data pointer classes should match. Add an adopting tag type and suitable constructors to the shared data pointer classes, and add take() to the classes lacking it. Drive by, apply qExchange to take()'s implementation. [ChangeLog][QtCore][QAdoptSharedDataTag] New class. It is now possible to adopt pointers to shared data into a QExplicitlySharedDataPointer or a QSharedDataPointer object without incrementing the object's reference counter. Change-Id: I62b8b005c1bfbe2add58566206fca27634bb7e70 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QMetaType: Silence float comparison warnings in QEqualityOperatorForTypeUlf Hermann2020-10-162-0/+6
| | | | | | | | We actually do want to invoke the original equality operator there. If that is unsafe, we cannot do much about it at this point. Change-Id: Iadb2eaba1156828d89022d282c41bda57b500b13 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix "variable set but unused" in qvariant.cppUlf Hermann2020-10-161-1/+1
| | | | | | | ... how did that pass the CI? Change-Id: I84baaf3632df0410d1fb25f24fd22f65daae13af Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Add comparison operators to shared data pointersAllan Sandfeld Jensen2020-10-161-32/+28
| | | | | | | To avoid they are compared as bools, or ambiguously. Change-Id: I1495b3126a71c1379e72d4cf53b1a67590eb9f4b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove redundant duplicate of EnableForNonVoid in QFutureWatcherAndrei Golubev2020-10-161-7/+1
| | | | | | | | | qfuturewatcher.h includes qfuture.h, which includes EnableForNonVoid through qfuture_impl.h header. Thus, there is never a need to keep the same alias in QFutureWatcher as it always can use one from QFuture Change-Id: I293fd087aea1a21ef5bcfdf50cdefc176a9703d0 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Fix subtle SFINAE problem in QPromise::addResultAndrei Golubev2020-10-161-3/+1
| | | | | | | | | | | | | | Accidentally found out that we enable/disable QPromise::addResult based on type deduced from input argument, instead of using "value_type" of QPromise itself, which is wrong Simplified the checks to a single one - EnableIfSameOrConvertible<InputType, StoredType> as this is sufficient to account for both cases: QPromise<void> and QPromise<T> with input, convertible to T Change-Id: I657998c0e26241b0fc5e70988622984ece8871df Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Rename QPromise starting and finishing methods to start and finishAndrei Golubev2020-10-162-13/+13
| | | | | | | | | Proposed during API review Change-Id: I9c43e1915c50803ab69bfe07a91c05d2224b86c4 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Make QPromise::addResult() return boolean status of operationAndrei Golubev2020-10-163-49/+56
| | | | | | | | | | | | | | | Changed QPromise::addResult() to return bool value. True is returned when result is added and false is returned when e.g. promise is in final state (canceled or finished) or when addResult() is called twice with the same index as argument (in which case new value is rejected) Updated QFutureInterface::reportFinished() that accepts optional result as argument to align with other result adding methods. This function is "internal" only (as of now), so no documentation update is needed Change-Id: I2d63069246e5e5c8cf04529c22bb296faaaae53d Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Fix some bad uses of QSharedPointerData::operator T*Allan Sandfeld Jensen2020-10-164-16/+18
| | | | | | | | Avoid detaching where possible Change-Id: I438d3e66689aeef05951af86a48af2a6910da7c2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Disallow promotion of bool and char in qMin and friendsLars Knoll2020-10-161-1/+3
| | | | | | | | | Feedback on the API review. Make sure, qMin<true, 'a'> and similar constructs don't compile. Change-Id: I59a66348a4168fe306159ddaf2595838d4ed66d1 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix signature of QDebug::toString()Lars Knoll2020-10-162-19/+3
| | | | | | | | We don't need two overloads here. Change-Id: Ia6a3bcd93491843e07b0295fefe8da42ae9d6519 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove default parameter from QUnifiedTimer::updateAnimationTimersVolker Hilsheimer2020-10-162-2/+2
| | | | | | | After adjustments in Qt Declarative, this parameter is no longer needed. Change-Id: I4b398748277aa29edd06ac122cfa8984575abf97 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Document noteworthy change in QProcessVolker Hilsheimer2020-10-161-0/+31
| | | | | Change-Id: I4d9769901aef8255fc111f33eb141e05398f0ee3 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Purge QDesktopWidgetVolker Hilsheimer2020-10-161-2/+1
| | | | | | | | | | | | It's no longer used; the only calls to QApplicationPrivate::desktop pass the default nullptr for QScreen, so all we need is a Qt::Desktop type toplevel widget. Include changes documentation about both the class and QApplication::desktop being gone in Qt 6. Change-Id: I22d6e93cabc6aaaefffe5e96942886a2ef4e0609 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QMultiHash: fix operator==Giuseppe D'Angelo2020-10-161-2/+7
| | | | | | | | | | | | An empty QMultiHash can still have an allocated dpointer, so we can't desume that two hashes are different because one has a dpointer and the other doesn't. Compares the sizes first, and infer that equal size, and non-zero size, mean both have a dpointer. Fixes: QTBUG-87575 Change-Id: I2e206bd071c02fb8970a4e77f8b0d29ad7e58bbe Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QHash: code tidiesGiuseppe D'Angelo2020-10-161-9/+5
| | | | | | | | | | Apply std::exchange. Remove a wrong comment about MultiNode -- the compiler isn't generating any move operations, the move constructor is user-provided and there isn't a move assignment operator... Change-Id: Idd69458c69cc93e4575c119daba564e0046452c1 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QOverload helpers: further cleanupsGiuseppe D'Angelo2020-10-161-3/+3
| | | | | | | constexpr inline means we can remove [[maybe_unused]]. Change-Id: I034b6e742ef750dc1ebeca1d9cc7a2463f8c7b70 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Floating point function helpers: code tidiesGiuseppe D'Angelo2020-10-161-6/+6
| | | | | Change-Id: Id87390734f4ccb28fb83d25788ca600747c2e2a8 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QtPrivate::Deprecated_t: code tidiesGiuseppe D'Angelo2020-10-161-1/+1
| | | | | Change-Id: I08ae749b32aa9a302937691c76b7910175c8a71a Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QESDP::take(): document that it doesn't derefGiuseppe D'Angelo2020-10-161-1/+4
| | | | | | Change-Id: Iba6c1caf4a7681815559db7c06691d02108ae855 Pick-to: 5.15 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* QTimeZone: drop an implicit conversion commentGiuseppe D'Angelo2020-10-161-1/+1
| | | | | | | | | The constructor isn't selected for conversions anyhow (it has more than one argument), and in Qt we don't mark such constructors as implicit (or explicit) anyways. Change-Id: I4203b946b9c6934aef9eead2db96154f9851ab9a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QVariant::compare: handle numerical values and pointers as documentedv6.0.0-beta1Fabian Kosmale2020-10-151-9/+80
| | | | | | | | [ChangeLog][QtCore][QVariant] Comparing two QVariants containing floating point numbers for equality no longer uses fuzzy comparisons. Change-Id: Iaba40a66d8fa566a432547fa1a30d5ea191c7fc0 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QOverload helpers: code tidiesGiuseppe D'Angelo2020-10-151-10/+4
| | | | | | | | | Remove pre-C++14 code paths; and mark as `inline` the qOverload helper objects (constexpr variables at namespace scope aren't automatically inline). Change-Id: Ieb2a9f06e39720d0c7215a3d1273c3a5996d0bc7 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Doc: Migration Guide for QString related changesKarsten Heimrich2020-10-151-0/+84
| | | | | | Task-number: QTBUG-87097 Change-Id: Idcdeaea5a65e91b99a08c2af03c7e76bbe5913bb Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Fix compile time type normalization codeLars Knoll2020-10-141-81/+146
| | | | | | | | | | | | | | | | | | | | | Use a simpler constexpr to generate type name on gcc This works around an ICE on gcc in release mode when compiling with PCH enabled. As the type we're getting from Q_FUNC_INFO is already in a somewhat normalized form, this requires significanlty less processing and esp. not a recursive constexpr method which I suspect triggers the ICE. Fix integer type conversions to also properly normalize long long values (to q(u)longlong. Make sure the mapping also works on MSVC, where long long types get mapped to __int64. Also, normalize unsigned short and unsigned char to ushort and uchar, respectively, to follow the convention set by uint and ulong. Add some test cases to verify the mappings. Change-Id: I3dec5764450bf22ab6f066597803c3f46c2cd5ac Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QMetaType: fix warning messageFabian Kosmale2020-10-141-1/+1
| | | | | Change-Id: I93c8b0d6b490cfed944a2a6a2b64361258a50141 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* General cleanup of qshareddata.hAllan Sandfeld Jensen2020-10-142-134/+135
| | | | | | | | Update the code to something more modern and make the two types more consistent. Change-Id: I524d33fea158e2ba7079fe836164eec03c45649b Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Long live Q_IMPLICIT!Giuseppe D'Angelo2020-10-145-19/+25
| | | | | | | | | | | | | C++20 will give us explicit(bool). While we can't use it just yet in its full potential, we can introduce a macro to start marking our implicit conversions (aka `explicit(false)`), removing the need for /* implicit */-like comments. Port a few usages to it. Change-Id: I336d5e4c8d51d8329627900d1059e59062c5cafd Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Drop qt_is_permutationGiuseppe D'Angelo2020-10-141-23/+0
| | | | | | | | | | It was a workaround until we could depend on C++14's std::is_permutation overload with 4 args. We now can, and the code using it is gone anyhow, so drop it. Change-Id: Ib9af71eeb767c83b1150c482441503288f1987d4 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Reject overwrites by the same index in QPromise::addResult()Andrei Golubev2020-10-134-8/+49
| | | | | | | | | | | | One can call addResult(value, index) twice and consequently set the value twice by the same index. This seems rather strange and probably should not be allowed. This commit rejects setting results when there's already a valid result by that index. Consequently, this fixes memory leaks caused by N-times-called addResult(..., index) Fixes: QTBUG-86828 Change-Id: I77494f2cb73ce727ffad721cfcdcaa420899eb25 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Remove nodiscard in QPropertyObserverNodeProtector ctorAndrei Golubev2020-10-131-1/+1
| | | | | | | | | Produced error in my GCC 7.5 on Ubuntu 18: error: ‘nodiscard’ attribute applied to ‘QPropertyObserverNodeProtector<<anonymous> >::QPropertyObserverNodeProtector(QPropertyObserver*&)’ with void return type [-Werror=attributes] Q_REQUIRED_RESULT QPropertyObserverNodeProtector(QPropertyObserver *&observer) Change-Id: Ic1f6c4f502bb4d5c764686d5521b92f655592bb2 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* doc: Add brief and group for native type conversionsTor Arne Vestbø2020-10-131-93/+153
| | | | | Change-Id: I74608619201bf77e487fb986bf213b349cc22f6a Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QCborValue: streamline some code with qExchangeGiuseppe D'Angelo2020-10-131-3/+1
| | | | | Change-Id: I79b68173a236ff1f28504a11ff182bdf48b2df0b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Mark the class QPropertyObserverNodeProtector as [[nodiscard]]Lars Knoll2020-10-131-1/+1
| | | | | | | And not its constructor, as GCC at least doesn't like that. Change-Id: I4aada7ca7135dd9c599980640588e7c98d398171 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QObject: simplify part of connection logicFabian Kosmale2020-10-131-16/+3
| | | | | | | | | | | We do not require anymore that the metatypes are declared beforehand, but can instead simply use QMetaType::fromType<T>().id(). This allows us to remove the templates containing the "metatype is declared" validation logic. Change-Id: I0b74c72643a233335689074091a38648f3e4f853 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Remove timeStep parameter from QAnimationDrive::advanceAnimationVolker Hilsheimer2020-10-133-19/+14
| | | | | | | | | | | | This reverts commit 7544c242cb935b5ff625e54c3facceea535c6ae5, which reverted the first removal of the parameter under the assumption that it caused flakiness in tests. The flakiness was instead caused by changes to the wait functions in QTest, so remove the parameter again. Change-Id: I98154d5d7268375aebbcb09de757e75d9b765c5f Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix detach on bool check of QSharedDataPointerAllan Sandfeld Jensen2020-10-131-0/+1
| | | | | | | | | We have a conversion to T* which would be triggered for a non negated bool check. Pick-to: 5.15 Change-Id: I543c66de6b4da64a3a63ee9a438fab6adcc58052 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* qDebug: Avoid implicit QVariant conversionFabian Kosmale2020-10-132-8/+11
| | | | | | | | | | | | | | | | | | | | | | | This commit restricts operator<<(QDebug lhs, QVariant rhs) to only work if rhs is actually of type QVariant (instead of any type convertible to QVariant). This is especially important as a) we check in QMetaType whether (slightly simplified) QDebug{} << std::declval<T>() is valid, and if so, register a function which simply uses the operator. b) In QVariant, we ask the metatype system for the contained types registered debug function and then use it. If a type now does not have its own operator<< for QDebug, but is implicitly convertible to QVariant containing itself, this would lead to an infinite recursion, when trying to use qDebug with that type. The registered function in a) would just convert the type to QVariant, and then ask the QVariant to print itself. Disallowing implicit conversions in qDebug in general was considered (i.e. adding template<typename T> operator<<(T) = delete in QDebug ), but discarded as it breaks too much code relying on conversions. Fixes: QTBUG-87122 Change-Id: Ib709297670cbc6cc307efd0dfd8e5b0279df9414 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* CMake: Rename qt6_quick_compiler_process_resources to be internalAlexandru Croitor2020-10-121-1/+1
| | | | | | Task-number: QTBUG-86827 Change-Id: I9d97b53a8c85e0c488be312c8894a1d73397eb13 Reviewed-by: Simon Hausmann <hausmann@gmail.com>
* Minor refinements in QLocaleEdward Welbourne2020-10-121-12/+9
| | | | | | | | | | A loop's condition could be simplified. Use std::size() rather than sizeof()/sizeof(). Clarify two comments. Change-Id: Ideba2e0e1ba9c9656297aefb0a375cc122ee8626 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Eliminate QLocaleId::fromIds() in favor of {...} constructionEdward Welbourne2020-10-122-23/+14
| | | | | | | | It's a value type, we don't need a pseudo-constructor to bypass constructors. Change-Id: Ic4774c82e43ab7e2c54ac743026ce087e34c150f Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Mark QLocale's Language, Country and Script enums as ushortEdward Welbourne2020-10-121-3/+3
| | | | | | | | | | The code pervasively presumes their values can be held in a ushort, so make sure the compiler knows we expect that to work (and doesn't complain about narrowing when we do convert them to ushort). Change-Id: Idde7be6cceee8a6dae333c5b1d5a0120fec32e4a Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Temporarily disable QFuture::takeResult() methodSona Kurazyan2020-10-123-25/+40
| | | | | | | | | | | | QFuture::takeResult() currently returns std::vector instead of QList, because QList does not support move-only types. Disable this method until QList is fixed to work with move-only types in Qt 6.1. Also did minor doc-fixes. Change-Id: I87feaf75d9433a3b540edd00039c3e21d6994985 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Fix build when configuring with -sanitize thread on gccMitch Curtis2020-10-121-1/+1
| | | | | | | | | There is no <sanitizer/tsan_interface.h> header when building with gcc, at least on Ubuntu 18.04.3. Fixes: QTBUG-87317 Change-Id: Ie933f6fa478f11b5062c665007e91be68e31ebe3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* CMake: Set some additional info variables in Qt6CoreConfigExtrasAlexandru Croitor2020-10-121-0/+2
| | | | | | | | | | Add info whether Qt was an infix built, and whether the reduce_exports feature was enabled. These variable were set before in Qt5CoreConfigExtras.cmake. Change-Id: Id077763cfffd5ee6f1a7a28d04cf92dc46390c54 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* CMake: Introduce Qt6::Startup targetAlexandru Croitor2020-10-123-8/+107
| | | | | | | | | | | | | | | | | | | | | | | | | Add an abstraction over Qt::WinMain (aka qtmain.lib) and iOS's runtime linker entry point (_qt_main_wrapper). The Core target will now link against the Startup target on all platforms, instead of just WinMain on Windows. The creation and linkage interface definition of the Startup target is done at find_package(Qt6Core) time via the private call of _qt_internal_setup_startup_target(). This will add automatic linkage of WinMain to executables marked with the WIN32_EXECUTABLE property on Windows. As well as the addition of the '-Wl,-e,_qt_main_wrapper' linker flag when linking iOS executables. Qt users can opt out of this behavior by either setting the QT_NO_LINK_QTMAIN property or variable. This is in line with Qt 5 behavior. Task-number: QTBUG-87060 Change-Id: I7d5e9f1be0e402cf8e67e6f55bfd285f9e6b04f4 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Fix "Runing" typo in CMake configDavid Skoland2020-10-121-1/+1
| | | | | Change-Id: I77f2970d70ab221e5d7d5c5d389041ed1b6c49f5 Reviewed-by: Daniel Smith <Daniel.Smith@qt.io>
* QMetaType: Avoid combination of extern and declspec(__dllexport) on MSVCUlf Hermann2020-10-122-5/+19
| | | | | | | | | MSVC does strange things with this, and it actually tells us so via a warning. We can, however, attach the dllexport to the definition, rather than the declaration of the symbols in order to resolve the problem. Change-Id: I9971e13afc6d8840c49ec20d21820a72c5407200 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QPropertyBinding: compare QMetaType directlyFabian Kosmale2020-10-121-1/+1
| | | | | Change-Id: I36fbc8ebed096aa6f7be48456005395b65229359 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>