summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qproperty.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Doc: Fix documentation issues for Qt CoreTopi Reinio2021-08-241-1/+2
| | | | | | | | | | | | | | | * Tag deprecated Q(Multi)Map operators in the header to correctly match them with documentation \fn commands. * Add documentation for QByteArrayView comparison operators. * Add a dummy typedef 'jfieldID' for generating docs correctly on non-Android platforms * Fix other minor issues Task-number: QTBUG-95860 Change-Id: I141d2f75d6aa10557aa374201f09ad74b4cd6e81 Reviewed-by: Paul Wicking <paul.wicking@qt.io> (cherry picked from commit 145940e1ef8fc8334ff4603a44f7896886e646cb) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Re-add QPropertyAlias functionalityFabian Kosmale2021-08-231-9/+34
| | | | | | | | | | | | | | | | | | As QPropertyAlias was public by accident in 6.0, we have to ensure that it still works in 6.2. This re-adds some tests for it, and reimplements the unlinking functionality. To avoid performance regressions in hot-paths, a new unlink_fast function is added, which behaves like the old unlink: It ignores the special handling for QPropertyAlias, so that we can skip the tag check. It is only used in QPropertyObserverNodeProtector and clearDependencyObservers, where we already know the type of the observer. Fixes: QTBUG-95846 Change-Id: Ifb405b8327c4d61c673b1a912ed6e169d27c2d8f Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit e4d62651c278c468f71ce097979bc1183ffd0713) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QProperty: Only try to avoid TLS access if currentThreadId is fasterFabian Kosmale2021-08-081-1/+9
| | | | | | | | | | | We will not gain anything if we have to do multiple function calls to obtain the thread id. Therefore we introduce a macro to signal that we have a fast implementation of currentThreadId, and only use the function if it is defined. Change-Id: I3347489ea91992896bb753b796ae26e391c2c99c Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit 5889985c8c8e8cc676de4480ad95979287860b96)
* QProperty: Avoid needlessly refetching bindingStatusFabian Kosmale2021-08-081-6/+9
| | | | | | | | If we already have the bindingStatus, we can just pass it along. Change-Id: Iaaea4f4c34e6a786899561293016ece163c26d25 Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit 3f0a32aeb50acf17302e44dcffc3210f199de6eb)
* QProperty: more micro optimizationFabian Kosmale2021-08-081-40/+14
| | | | | | | | | | | | | - Provide an inline version of evaluateRecursive which does not fetch the status. - Provide an unsafe variant of setBindingToNotify which does not set the tag. This can be used in allocateDependencyObserver, as newly allocated observers already have the correct tag (this is checked via an assert). Change-Id: I31aec6af4aef244efc6d0777e5bfaaa8f82f2046 Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit f7eed15588fc93af417b8969fe4e498936d81e04)
* Pass QBindingStatus to evaluateBindingsFabian Kosmale2021-08-081-10/+9
| | | | | | | | | This avoids another round of TLS lookups in evaluateRecursive when we construct the BindingEvaluationState. Change-Id: Icfa9fd81fc6f54623d384c4d3fce33f4d4d549b9 Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit e5aff7f3d9e90860fe24b8fe931a71e115f5413b)
* Avoid superfluous QBindingStoragePrivate::get callFabian Kosmale2021-08-041-1/+3
| | | | | | | | | | If we have no currentBinding, then registerWithCurrentlyEvaluatingBinding will not do anything. Thus we can completely avoid fetching the storage. Change-Id: Ic20142e4c4e09752b5c41b959f66080e6885e6c3 Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit b8e1782b670a10fe551669bdce654025acba225f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QProperty: micro optimizationsFabian Kosmale2021-08-041-1/+1
| | | | | | | | | | | | | | - Ensure that the allocateDependencyObserver fast path is inlined. - Use addObserver instead of observerProperty; we know that a freshly allocated observer does not have its prev pointer set. If prev weren't a private member, we could simply use Q_ASSUME(ptr->prev == nullptr), but making it public or befriending the class seems like a bad idea, as it grants too much access to the internals. Change-Id: Ia845f2807c70512563f7b9e1ecb85fe82b66208c Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit 5d0095b1c2e60ecfb492c1910df70021128d663c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Avoid TLS access for groupUpdateDataFabian Kosmale2021-08-041-4/+14
| | | | | | | | | | | | By putting the groupUpdateData pointer into the same thread local as the binding status, we avoid having to fetch two thread_local variables. Moreover, we can reuse the caching mechanism which we have in place for QBindingStatus to avoid costly TLS lookups. Change-Id: Iaea515763510daab83f89b8e74f35a80965d6965 Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit 71fea09e1a8d1fc5d9cca7c504f45b77725c0e21) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QProperty: Avoid TLS lookup if we are in the same threadFabian Kosmale2021-08-041-1/+14
| | | | | | | | | | | | | | | | | | | If the QBindingStatus we receive from the QObject is from the thread which is currently running, we do not need to refetch the thread local; the reason we refetched the thread_local was after all only to guard against the case where a QObject's property gets read in a different thread. To determine whether we are in the same thread, we can store the thread id in the thread_local structure. Currently, it only gets initialized for the main thread in QCoreApplication (as bindings are mostly used there). At a later point, we could either expose initBindingStatusThreadId, or call the function when a QThread gets started. Change-Id: Id8eb803973bb083abfab83a62bfccc9e88a4e542 Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit 460700f7736ae308bcbaa37f512355d09876dc8b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QProperty: Downgrade assert in noSelfDependencies to warningFabian Kosmale2021-07-071-1/+4
| | | | | | | | | | | | | | | | We call evaluateRecursive_inline in setBinding, which in turns runs the noSelfDependecies check. However, creating a binding resuting in a binding loop must not crash, but instead result in the binding entering an error state. To prevent a crash caused by the assert in debug builds of Qt, we replace the assert with a warning for now. A better approach in the future would be to ensure that we only run the check in cases where we are sure that a self-dependency is really a fatal error. Change-Id: I58158864ed81fa907132a4e7d6667c9b529e7e64 Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io> (cherry picked from commit fd308819891fdc3c4296050193e97f5d9259501f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix binding functor addressing in QPropertyAndrei Golubev2021-07-051-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | We create the callable object at sizeof(QPBP) offset from the beginning of the memory block. However, evaluateRecursive() uses sizeof() + alignment when fetching that same callable from the memory While on 64-bit platforms this is fine due to sizeof(QPBP) == QPBP::getSizeEnsuringAlignment(), this is broken for 32-bit systems where there's actually alignment bits that follow the QPBP struct in memory (and thus we cast a random memory location to an object) (Note: QPBP is short for QPropertyBindingPrivate) To fix this, change the offset for creation and destruction of the callable to the one that uses alignment. This way, evaluateRecursive() code becomes correct Fixes: QTBUG-93890 Change-Id: Ief57051846632fa61df4b79b3f054c25062a9498 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 565864090d4ca38768c2268ffd265d2f4b49d1b0) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Bindable property docs: mention virtual setters and gettersIvan Solovev2021-06-151-0/+25
| | | | | | | | | | | Update the bindable property docs to explain how to deal with virtual getters and setters. Task-number: QTBUG-92994 Change-Id: I6c29011817e83623414b39afee0f39ad4cc5c1c9 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit c0716994f3a089b41b5a3d05372f4fc2fb4f51c9) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Doc: QtCore: Fix more documentation warningsTopi Reinio2021-06-071-5/+5
| | | | | | | | | | | | | | * Omit 'Bluetooth' enum value in QPermission::PermisionType (sic) as that seems to be unimplemented. * Comment out \sa links to internal/undocumented functions. * Fix incomplete template parameters in \fn commands for QProperty methods. Task-number: QTBUG-93995 Change-Id: Ic8e63fca22c9c72325c76f90f537b221f56ebace Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QProperty: Do not involve semi-destroyed QObjects in bindingsFabian Kosmale2021-06-071-0/+6
| | | | | | | | | | | | | Once we're in ~QObject, only methods of QObject are still valid. Notably, no setter of any derived class is still valid. Thus, to be safe we must no longer react to binding changes of those properties. To ensure that this happens for QObjectCompatProperty properties, we explicitly clear the binding storage. Fixes a particles3d example crash. Change-Id: I10d2bfa5e96621ce039d751cffaf3ac41893623e Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Avoid unnecessary work when linking observersUlf Hermann2021-06-051-1/+1
| | | | | | | | We already do most of the work of setFirstObserver() in the method body before. Change-Id: Ia31f19ca656675dddb692609d8875c5d48e967f1 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QProperty: Refresh the observers after evaluating bindingsUlf Hermann2021-06-041-8/+13
| | | | | | | | | Evaluating bindings may actually break bindings, and remove observers. Therefore, we need to re-fetch for notifying afterwards. Fixes: QTBUG-94220 Change-Id: I96a78a825f983f58f1a574bf886e643f54453fdc Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Simplify storing of notification objectsLars Knoll2021-06-011-7/+90
| | | | | | | | | | | | | | | | | | | | QPropertyChangeHandler is a templated class and it's argument is a functor. That makes it inherently cumbersome to use the class in any context where the change handler needs to be stored. Introduce a QPropertyNotifier class that stores the functor in a std::function<void()>, and add a QProperty::addNotifier() method that can be used instead of onValueChanged(). Also make QPropertyNotifier default constructible. This significantly simplifies the code that needs to be written and makes it possible to store notifications as class members without major hassle. Fixes: QTBUG-92980 Change-Id: Id5b7baec093b9ac0467946cded943d92ad21030b Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Doc: QtCore: Fix documentation issuesTopi Reinio2021-06-011-29/+4
| | | | | | | | | | | | | | | | | | * Add module header wrapper that loads the real QtCore header and qandroidextras_p.h to generate docs for those types * Add missing dummy typedefs to doc/include/jni.h * Use the correct \namespace name (QtAndroidPrivate) and mark it as \preliminary * Add missing 'const' specifier for Q[Untyped]Bindable methods * Drop documentation for removed method QProperty::markDirty() * qmath.h: Fix \fn commands for qFloor(), qCeil() * QHashSeed: Drop incorrect usage of \relates Fixes: QTBUG-93942 Task-number: QTBUG-93995 Change-Id: If76b5aa4b79a64add3cb6275eac82ec44ef10319 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Document that QProperty::subscribe might get executed deferredAndreas Buhr2021-05-201-6/+13
| | | | | | | | | | | With the introduction of grouped property changes, notification calls in bindable properties might be immediate or deferred, depending on the context. This patch documents that one must not rely on immediate execution of functions given to subscribe() and onValueChanged(). Change-Id: I26ec4dbbff17a44ab62037ba1da9ce34c77da972 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QPropertyBinding: Do not reevaluate if not installed on propertyFabian Kosmale2021-05-121-0/+1
| | | | | | | | | | | | | | | | | | | | | | Since we changed binding evaluation to be always eager, we notify and evaluate all bindings as soon as any dependency changes. This includes bindings which have been initially installed on a property, but which were later removed. With lazy evaluation, we would only notify those bindings and mark them as dirty, which is unproblematic. With eager evalution, we attempt to evaluate the binding, though. While that part is still fine, afterwards we would attempt to write the new value into the property. However, there is no property at that point, as the binding is not installed. Instead of adding a check whether the propertydataptr is null, we skip the reevaluation completely by removing the bindings observers - and thus the cause for the binding function's reevaluation. As soon as the binding is set, we reevaluate the function anyway, at which point we also capture the observers again. Task-number: QTBUG-89505 Change-Id: Ie1885ccd8be519fb96f6fde658275810b54f445a Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QProperty: Cleanup QPropertyAlias leftoversFabian Kosmale2021-05-111-17/+3
| | | | | | | | | | | | | | | This removes traces of QPropertyAlias which is internal API which is a) not really working even before this change (no compatibility with QBindableInterface due to QPropertyAlias not being derived from QUntypedPropertyData) b) not used anywhere For BIC reasons, we need to keep some methods still around until Qt 7, though. Change-Id: I5bb4735a4c88cba275dc2cc6e29a46ca09622059 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Add QUntypedBindable::metaType functionFabian Kosmale2021-05-031-0/+10
| | | | | | | | | | | | | | | This enables checking the metaType of a QUntypedBindable in the public interface. In addition, work around an oversight that can only be fully addressed in Qt 7: The metatype function pointer does not take a QUntypedPropertyData * parameter. However, we need this functionality for an efficient QBindable proxy implementation in declarative (which is needed to implement interceptors there). To work-aronud this in Qt 6, reuse the value getter and turn it into a metatype getter if the value pointer is flagged. Change-Id: Ia3cce08ea761fce57bce59e02212525b996f2fee Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Q(Untyped)Bindable: Print warnings when operations failFabian Kosmale2021-05-031-0/+33
| | | | | | | | | Instead of silently failing, we now print an explanatory warning to aid with debugging. Task-number: QTBUG-89512 Change-Id: I36dd2ce452af12d0523c19286919095e366bd390 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QObjectBindableProperty: Allow signals taking a valueFabian Kosmale2021-04-221-0/+4
| | | | | | | | | | | | | If the signal takes a value, we pass the current value of the property to it. As we now use eager evaluation, accessing the current value is now possible. Change-Id: I5e6947a6575bfa8ca5143f56620c645d4750a686 Reviewed-by: Andreas Buhr <andreas.buhr@qt.io> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Add QObjectBindableProperyt::notifyFabian Kosmale2021-04-221-7/+10
| | | | | | | | | | | This mirrors the functionality of QObjectCompatProperty::notify, and can be useful to delay notifications until a class invariant has been restored. Change-Id: I1c16a0b1537a1b53d144c8abe48e546553edf877 Reviewed-by: Andreas Buhr <andreas.buhr@qt.io> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QPropertyBinding: Add sticky modeFabian Kosmale2021-04-161-0/+3
| | | | | | | | | | | A sticky QPropertyBinding is a binding that does not get removed when a write occurs. This is used in the QML engine to implement support for the QQmlPropertyData::DontRemoveBinding flag. Task-number: QTBUG-91689 Change-Id: Ib575b49abe634215318ccc7ba46212cc21eb4dad Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Add support for grouped property changesLars Knoll2021-04-161-23/+212
| | | | | | | | | | | | | | | | Add Qt::begin/endPropertyUpdateGroup() methods. These methods will group a set of property updates together and delay bindings evaluations or change notifications until the end of the update group. In cases where many properties get updated, this can avoid duplicated recalculations and change notifications. Change-Id: Ia78ae1d46abc6b7e5da5023442e081cb5c5ae67b Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Andreas Buhr <andreas.buhr@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Don't emit change notifications more often than requiredLars Knoll2021-04-161-11/+59
| | | | | | | | | | | | | | | | When a property value changes, first update all dependent bindings to their new value. Only once that is done send out all the notifications and changed signals. This way, if a property depends on multiple other properties, which all get changed, there will only be one notification; and (potentially invalid) intermediate values will not be observed. Fixes: QTBUG-89844 Change-Id: I086077934aee6dc940705f08a87bf8448708881f Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Andreas Buhr <andreas.buhr@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Address thread safety issues in QProperty classesFabian Kosmale2021-04-161-2/+12
| | | | | | | | | | | | | | | | While we do not support cross-thread bindings, reading of properties from a different thread when no bindings are involved must continue to work. However the check whether bindings are involved used the QBindingStatus in the QObjectPrivate. That one contains the wrong value when the QObject is accessed from a different thread than the one it has affinity with. This patch reads from the thread_local directly instead to sidetstep the issue. Change-Id: I8ce2092f35e210566934e2439beb5d48fd8cf226 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Remove lazy binding evaluationLars Knoll2021-04-161-87/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | Too much of the existing code in Qt requires eager evaluation without large scale modifications. Combined with the fact that supporting both eager and lazy evaluation has a high maintenance burden, keeping lazy evaluation, at least in its current state, is not worth it. This does not diminish other benefits of the new property system, which include - a C++ API to setup and modify bindings and - faster execution compared to QML's existing bindings and the ability to use them without having a QML engine. We do no longer benefit from doing less work thanks to laziness. A later commit will introduce grouping support to recapture some of this benefit. [ChangeLog][Import Behavior Change][QProperty] QProperty uses always eager evaluation now when a dependency in a binding changes. Change-Id: I34694fd5c7bcb1d31a0052d2e3da8b68d016671b Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Andreas Buhr <andreas.buhr@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Add documentation how to formulate a property bindingAndreas Buhr2021-03-261-0/+6
| | | | | | | | | | | To correctly formulate a property binding, some rules must be followed. So far, these rules are not documented. This patch adds such documentation. Task-number: QTBUG-90511 Change-Id: Ibb509ea9098212c95f03433feb1f1aac751c4b2e Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Add documentation for internal Q_OBJECT_COMPUTED_PROPERTYAndreas Buhr2021-03-251-0/+93
| | | | | | | | | | The internal class QObjectComputedProperty and the associated macro Q_OBJECT_COMPUTED_PROPERTY did not have any documentation so far. This patch adds some initial documentation. Task-number: QTBUG-90511 Change-Id: Ibd31b9c482962b1618daf04fef4256aa52d589e3 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Add example to QObjectBindableProperty change handler docsAndreas Buhr2021-03-251-0/+4
| | | | | | | | | QObjectBindableProperty has a callback, which is called whenever the value changes. This patch adds an example showing this. Task-number: QTBUG-90511 Change-Id: I56c0bce15af8121159630b5c0922c287c15b7618 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Add documentation for internal Q_OBJECT_COMPAT_PROPERTYAndreas Buhr2021-03-251-0/+63
| | | | | | | | | | | The internal class QObjectCompatProperty and the associated macro Q_OBJECT_COMPAT_PROPERTY did not have any documentation so far. This patch adds some initial documentation. Task-number: QTBUG-90511 Change-Id: Ie55e7d7829363bd5a29430a4250ddba14a761912 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Doc: Fix warnings on qproperty.cppTopi Reinio2021-03-101-18/+22
| | | | | | | Task-number: QTBUG-90662 Change-Id: I91f8b83c68c3692dc620063c93be9ddea64685a6 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Add documentation for Q_OBJECT_BINDABLE_PROPERTYAndreas Buhr2021-03-051-0/+23
| | | | | | | | | | | | | | | The duo Q_OBJECT_BINDABLE_PROPERTY and QObjectBindableProperty can only be documented together. The documentation is now with QObjectBindableProperty. This patch adds a documentation entry for Q_OBJECT_BINDABLE_PROPERTY which links the user to QObjectBindableProperty. Task-number: QTBUG-90511 Pick-to: 6.0 6.1 Change-Id: I9af4a99d49f4b02ee9645a2cc9a9a024a6a1a552 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Document requirements for getters and setters of bindable propertiesAndreas Buhr2021-02-251-6/+8
| | | | | | | | | | | | | Getters and setters of bindable properties have to be carefully written to avoid several problems. This patch adds documentation for this. Task-number: QTBUG-89505 Task-number: QTBUG-90511 Change-Id: Ib25590b3d8d95c490d9555c0f258f48cb6cfe4a9 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix some qdoc-warnings for 6.1Friedemann Kleint2021-02-181-1/+3
| | | | | | | | | | | | | | | | | Fix: qtbase/src/testlib/qtestelementattribute.cpp:89: (qdoc) warning: Undocumented enum item 'LET_Message' in QTest::LogElementType qtbase/src/testlib/qtestelementattribute.cpp:89: (qdoc) warning: No such enum item 'LET_Error' in QTest::LogElementType qtbase/src/testlib/qtestelementattribute.cpp:89: (qdoc) warning: Undocumented enum item 'LET_SystemOutput' in QTest::LogElementType qtbase/src/network/ssl/qsslsocket.cpp:1666: (qdoc) warning: Unknown command '\cl' qtbase/src/corelib/kernel/qproperty.cpp:883: (qdoc) warning: Unknown command '\T' qtbase/src/corelib/kernel/qproperty.cpp:799: (qdoc) warning: Undocumented return value (hint: use 'return' or 'returns' in the text qtbase/src/corelib/kernel/qjnienvironment.cpp:250: (qdoc) warning: Undocumented return value (hint: use 'return' or 'returns' in the text Pick-to: 6.1 Change-Id: I116f5d8ace2c29ba7b6b93256d5761591e01296a Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Nico Vertriest <nico.vertriest@qt.io>
* Doc: Fix documentation warnings qtbaseNico Vertriest2021-02-181-4/+4
| | | | | | Task-number: QTBUG-90662 Change-Id: If31847f8f2b8b57a8a8624d0406a030b5752f1c8 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Mark QPropertyAlias as internalFabian Kosmale2021-02-151-0/+2
| | | | | | | | | That class was only really meant for the QML compiler, and it is dubious if event that one needs it. The current implementation is also broken. Pick-to: 6.1 6.0 Change-Id: Ie40d282707f3fabc8079bee9e98f082aeb9d30b3 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QPropertyBindingPrivate: Support QQmlProperyBindingFabian Kosmale2021-02-151-1/+1
| | | | | | | | | QQmlProperyBinding needs the ability to suspend binding evaluation, and needs access to the propertyDataPtr. Change-Id: If82079ffdf28fb277c6e5083714c28478f6e1729 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Fix minor documentation typos in bindable propertiesJuha Vuolle2021-02-151-1/+1
| | | | | | Change-Id: I4f8474820db613a675950a858438337558f1c88f Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* QProperty: Treat change listener modifying its source property as a loopFabian Kosmale2021-01-281-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is in line with QML where import QtQuick 2.15 Rectangle { width: 100 height: 100 color: "red" Rectangle { id: inner x: 10 y: x width: 50 height: 50 onYChanged: { console.log("hey"); inner.x = 10} TapHandler { onTapped: inner.x = 20 } } } results in a binding loop warning when the tap handler triggers. While the change handler would only run once, we cannot statically determine if we need to loop once, twice, or if there actually is a diverging loop. Thus we unconditionally warn about the binding loop and stop executing the binding. As a drive-by, verify in the related test that a change handler which overwrites its properties binding itself removes the binding. Change-Id: I5372019c2389ab724c49cd7489ecbd3ebced1c69 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Create bindable property overview documentationAndreas Buhr2021-01-281-54/+5
| | | | | | | | | | | So far, all documentation about bindable properties was in the corresponding classes QProperty and QObjectBindableProperty. This patch creates one documentation page for a general introduction to bindable properties and information concerning all of those classes. Change-Id: Ib718dbeb385c3899fb34cc2ce03bec7a8d43a034 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Q(Untyped)Bindable: add takeBinding methodFabian Kosmale2021-01-271-1/+20
| | | | | | | | | | | We missed takeBinding as a supported operation on Q(Untyped)Bindable. To avoid adding version checks to code dealing with QBindableInterface, we simply synthesize takeBinding as a combination of binding to retrieve the binding and setBinding with a default-constructed QUntypedPropertyBinding. Change-Id: I43803a0dfe210353d0235f0373d2257f75ffe534 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QBindable: add initial documentationFabian Kosmale2021-01-271-0/+72
| | | | | | Change-Id: I43681093c8819289037c76bd9c05b88a6da8311b Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QProperty: Add private isAnyBindingEvaluating functionFabian Kosmale2021-01-211-0/+15
| | | | | | | | | | | | | | | | | To optimize certain operations, it can be useful to know whether we are currently evaluating a binding. For instance, we have properties whose storage is only alloctaed on-demand when they are set. However, we would also allocate them if they are used in a binding context, as we would otherwise not properly track the dependency. Using isAnyBindingEvaluating in the getter, we can detect this situation, and avoid the allocation if it returns false. This API is private for now, as it exposes some internals of the property system and should be used with care. As it needs to access the TLS variable, it also has a non-negligible cost. Change-Id: I373aabee644fe7020b2ffba7d6a0ad9a1e1b4ec0 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QUntypedBindable: Add documentationFabian Kosmale2021-01-181-0/+113
| | | | | | | Task-number: QTBUG-89505 Change-Id: I4428c3c0eb723e996195f6f6f5ac736757cea33e Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Clarify variable names in QPropertyObserverPointer::notifyAndreas Buhr2021-01-111-13/+9
| | | | | | | | | | | | | | In QPropertyObserverPointer::notify and its calling sites, variable names "alreadyKnownToHaveChanged", "knownIfPropertyChanged", "propertyChanged", and at its calling site "knownIfChanged" are used. This is confusing. This patch changes those four to "knownToHaveChanged". For the logic implemented it is not necessary to track whether we have knowledge about having changed and whether it has actually changed (if we have knowledge) separately. Change-Id: I90b86b276ab67b2ed70dba4e456cd90220588870 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>