aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickstateoperations.cpp
Commit message (Collapse)AuthorAgeFilesLines
* QtQml: Make QQmlNullableValue somewhat saferUlf Hermann2024-01-081-16/+20
| | | | | | | | We need it movable, and you shouldn't be able to poke its internals. Change-Id: Ia9fbde26ef525837402d9214aa534eeec0221e2f Reviewed-by: Sami Shalayel <sami.shalayel@qt.io> Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
* Include what you need: <QPointer>Marc Mutz2023-10-061-0/+3
| | | | | | | | | | | | | | | | | | | | | | | All these TUs relied on transitive includes of qpointer.h, maybe to a large extent via qevent.h, though, given that qevent.h is more or less the only public QtBase header that includes qpointer.h, something else seems to be at play here. Said qevent.h actually needs QPointer in-name-only, so a forward declaration would suffice. Prepare for qevent.h dropping the include. The algorithm I used was: If the TU mentions 'passiveGrabbers', the name of the QEvent function that returns QPointers, and the TU doesn't have qpointer.h included explicitly, include it. That may produce False Positives, but better safe than sorry. Otherwise, in src/, add an include to all source and header files which mention QPointer. Exception: if foo.h of a foo.cpp already includes it, don't include again. Task-number: QTBUG-117670 Change-Id: I9b98cda524a0e6a61be7805edda708916bb2bc2b Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* AnchorChanges: Fix restore logicFabian Kosmale2023-03-291-2/+13
| | | | | | | | | | | | | | | | | | | The logic to decide whether a state change triggered a size change. When AnchorChanges did not remove all old anchors, we might end up with an anchor configuration that changes the size of an item (e.g., anchors.left and right being set), even if the new state only adds a single anchor, e.g. anchors.left. Moreover, we need to pass the correct dirty flags to setDirty, otherwise the UI will not actually reflect the state of the Item. As a driveby, fix an accidental double negation of qt_is_nan for height. Fixes: QTBUG-112354 Fixes: QTBUG-106677 Pick-to: 6.5 6.2 Change-Id: I6c456fbdc314672f4fcbe740d941b44183fd5500 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Port from container::count() and length() to size()Marc Mutz2022-10-071-1/+1
| | | | | | | | | | | | | | | | | | | | This is a semantic patch using ClangTidyTransformator as in qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8: auto QtContainerClass = anyOf( expr(hasType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))))).bind(o), expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o)); makeRule(cxxMemberCallExpr(on(QtContainerClass), callee(cxxMethodDecl(hasAnyName({"count", "length"), parameterCountIs(0))))), changeTo(cat(access(o, cat("size"), "()"))), cat("use 'size()' instead of 'count()/length()'")) a.k.a qt-port-to-std-compatible-api with config Scope: 'Container', with the extended set of container classes recognized. Change-Id: Idb1f75dfe2323bd1d9e8b4d58d54f1b4b80c7ed7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Use SPDX license identifiersLucie Gérard2022-06-111-38/+2
| | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Pick-to: 6.4 Task-number: QTBUG-67283 Change-Id: I63563bbeb6f60f89d2c99660400dca7fab78a294 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QQuickAnchorChanges: Keep geometry bindings on reverse() and rewind()Ulf Hermann2022-03-021-15/+44
| | | | | | | | | | | This is in line with what we do in other reverse() and rewind() methods. Unfortunately we need to dig deep into the QQuickItem internals in order to get all the flags and callbacks right. Pick-to: 6.2 6.3 Fixes: QTBUG-101186 Change-Id: Icde1a1b2dab1b9cab5adcbc28485a7526a8ac2b7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QQuickStateOperations: updateGeometry() when setting x/y/w/hUlf Hermann2022-03-011-5/+5
| | | | | | | | | | | Failing to call updateGeometry() and setting the various dirty flags leads to inconsistent state. Pick-to: 6.2 6.3 Fixes: QTBUG-99436 Fixes: QTBUG-98857 Change-Id: I15240b1670947da29e2f05e7ea41c7586f0b987a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* ParentChange: handle bindable propertiesFabian Kosmale2021-10-181-16/+12
| | | | | | | | | | | | | | | | | | QQuickParentChange::actions was unable to handle new style properties. Fix this by using a QQmlAnyBinding create function instead of QQmlBinding. This required adding the necessary support for creation from a QQmlScriptString to QQmlProperyBinding and QQmlAnyBinding. Extra care had to be taken in reverseRewindHelper, which assumed that setting x/y/width/height would keep binding intact. We therefore use setValueBypassingBindings instead of the plain setter. Fixes: QTBUG-97480 Pick-to: 6.2 6.2.1 Change-Id: I0cc6d61c655d9d37846adf4b09fe103f507bb329 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Move moc includes out of the namespaceMårten Nordheim2021-09-161-2/+1
| | | | | | | | | | | | | | | | | When building with namespace enabled it creates weird errors: In file included from /qt/src/qtdeclarative/src/quick/util/qquickstatechangescript.cpp:149: In file included from /qt/android/qtdeclarative/src/quick/Quick_autogen/include\moc_qquickstatechangescript_p.cpp:11: In file included from /qt/android/qtbase/include\QtNetwork/QSslError:1: In file included from /qt/android/qtbase/include/QtNetwork/qsslerror.h:1: In file included from /qt/android/qtbase/include/QtNetwork/../../../../src/qtbase/src/network/ssl/qsslerror.h:46: In file included from /qt/android/qtbase/include\QtNetwork/qsslcertificate.h:1: /qt/android/qtbase/include/QtNetwork/../../../../src/qtbase/src/network/ssl/qsslcertificate.h:170:1: error: class template specialization of 'QMetaTypeId' not in a namespace enclosing 'qt' Pick-to: 6.2 Change-Id: I83110824f2a3380827c9656490af791b5d614907 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Doc: fix AnchorChanges typoJeremy Katz2021-08-121-1/+1
| | | | | | Pick-to: 6.1 6.2 5.15 Change-Id: I6e5cc9807ddc2ae6a40a864b3154fe93fcc32d69 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Fix life cycle methods for some QML-exposed typesUlf Hermann2021-07-141-8/+0
| | | | | | | | | Follow the rule of 5: Drop empty dtors, and add Q_DISABLE_COPY_MOVE where we do need an explicit dtor. Change-Id: Icbb9d87e1087c69b1cf1f18062a496c148935783 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* QQuickItemPrivate: Make {width,height}Valid a functionFabian Kosmale2021-06-301-4/+4
| | | | | | | | | | There is now some additional logic, so we cannot simply rely on the boolean flag. Task-number: QTBUG-94703 Pick-to: 6.2 Change-Id: Id4674efd205a58b015a82b3c06e63c8a031f6607 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Use QQmlBinding::Ptr typedefFabian Kosmale2021-02-101-7/+7
| | | | | | | | | | Instead of spelling out QExplicitlySharedDataPointer<QQmlBinding>. That is consistent with all other code, and makes grepping for binding pointers easiers, as they now all end with Binding::Ptr. Change-Id: I19018732a699368200f129cecf869ece1c8b1a7f Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Avoid initializing QFlags with 0 or nullptr in further casesFriedemann Kleint2019-11-251-5/+0
| | | | | | | Amends 744e77b841878fb017c0f2d60607090008f28180. Change-Id: I16e37aaf503eb62f67fca0e48be4c92c4a72ae46 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* ParentChange: Restore old position correctlyFabian Kosmale2019-10-111-38/+51
| | | | | | | | | | | | | | | ParentChange does floating point math in doChange to calculate the correct position. Unfortunately, while doing the conversion, we accumulate rounding errors in the presence of rotations. Those can lead to visual glitches, as observed in QTBUG-68176. This patch avoids the issue by storing the old values and resetting to them in restore. Fixes: QTBUG-68176 Change-Id: I6ebe1ccbc601838aa664cdc723e0cd58c95e785a Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Small performance improvements suggested by clang-tidyAlbert Astals Cid2019-10-071-6/+6
| | | | | | | | | mostly add const &, a few std::move and in particular case, remove const so the std::move being done over the variable actually has effect Change-Id: Id611cd31bc012f219d7a17d4626b1c2a5fbddd66 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Doc: Add missing dots (qtdeclarative)Paul Wicking2018-06-191-2/+2
| | | | | | Task-number: QTBUG-68933 Change-Id: Ibb5aa227e82825085e7214e17dcffcb17fd44157 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* use nullptr consistently (clang-tidy)Shawn Rutledge2018-02-261-23/+23
| | | | | | | | | | | | | From now on we prefer nullptr instead of 0 to clarify cases where we are assigning or testing a pointer rather than a numeric zero. Also, replaced cases where 0 was passed as Qt::KeyboardModifiers with Qt::NoModifier (clang-tidy replaced them with nullptr, which waas wrong, so it was just as well to make the tests more readable rather than to revert those lines). Change-Id: I4735d35e4d9f42db5216862ce091429eadc6e65d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Disambiguate QQuickStateActionEvent::overrideKevin Funk2017-09-251-2/+2
| | | | | | | | | | Don't use override as function name, may create confusion with the official override specifier since C++11 Rename method to QQuickStateActionEvent::mayOverride Change-Id: I1f34ec1127cc3e7c529b7e0aa3272fbfed553fa1 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Use qRadiansToDegrees() more widelyEdward Welbourne2017-03-161-1/+1
| | | | | | | | It documents the meaning of the computation more clearly. Task-number: QTBUG-58083 Change-Id: Ie2d486d1e1919569de5a1565e783703b9b3bc813 Reviewed-by: Robin Burchell <robin.burchell@crimson.no>
* Port existing qmlInfo callers to qmlWarningRobin Burchell2017-01-111-4/+4
| | | | | | | | | | | | | Now that qmlInfo actually reports info messages, we want to change existing callers to use warning-level messages to preserve the original message level. This was done through: perl -p -i -e "s/qmlInfo\(/qmlWarning\(/" **/*.{cpp,h,qdoc} .. with a little care taken to only add the hunks that should be changed. Change-Id: I511cee11ce0a26ec1048cd2b84c7536b812a0d89 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Quick: mark some methods as constAnton Kudryavtsev2016-10-121-4/+4
| | | | | | | These methods do not modify objects. Change-Id: Ibb2622cad6fbcec31c785f5d032304c648372350 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QML: Specialize bindings based on target property type.Erik Verbruggen2016-06-271-13/+13
| | | | | | | | | | | When we can determine the type of a target property during type compilation, we can skip a whole bunch of code that deals with converting the result of a binding to the correct (target) type. This removes 65 instructions on x86 for such typed bindings. Change-Id: Id2c7c57b9ae6dfbeb921121beae9630604ca1d17 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Updated license headersJani Heikkinen2016-01-191-14/+20
| | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: Ic36f1a0a1436fe6ac6eeca8c2375a79857e9cb12 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Get rid of QQuickStateActionEvent::ReasonLars Knoll2015-06-101-20/+4
| | | | | | | | This doesn't do anything useful anymore afaict now that bindings are refcounted. Change-Id: I829facaa1bd463f90653a4190f08f8d04f31a6a4 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Make bindings refcountedLars Knoll2015-06-101-115/+66
| | | | | | | | | | | Refcounting our bindings greatly simplifies our memory management of the objects and ensures we safely clean them all up. In addition, it allows us to remove the m_mePtr and weak reference handling from QQmlAbstractBinding as we can safely handle this through the same mechanism. Change-Id: If23ebc8be276096146952b0008b62018f5d57faf Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Get rid of QQmlBinding::property()Lars Knoll2015-04-271-14/+14
| | | | | | | The method is slow and not required anymore Change-Id: I8c2bc6eeedbd15b901b60aa08408fe8c32a81707 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Make removal of bindings explicitLars Knoll2015-04-251-21/+21
| | | | | | | This simplifies the code for further refactoring. Change-Id: I6bcb5ce397f642242af80ce37dc8bba1fa9bf3f5 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Cleanup math function includes and usageAllan Sandfeld Jensen2015-02-191-1/+1
| | | | | | | | Use std::math on floats and doubles, and qMath on qreals, and only include the math headers actually needed. Change-Id: I1d511d7b1bac0050eaa947c7baee760b736858bf Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Update copyright headersJani Heikkinen2015-02-121-7/+7
| | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Change-Id: I61120571787870c0ed17066afb31779b1e6e30e9 Reviewed-by: Iikka Eklund <iikka.eklund@theqtcompany.com>
* Add null check for target as wellHolger Hans Peter Freyther2015-01-141-1/+1
| | | | | | | | | | I couldn't see any documentation for the implication that if stackBefore is set then target must not be null. Coverity didn't find that implication either. Change-Id: Ifb93aa4c1e40f417033057b9a403d368dfdf0ba8 Fixes: Coverity CID 10627 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Update license headers and add new licensesJani Heikkinen2014-08-251-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 & LICENSE.GPLv2 - Removed LICENSE.GPL Change-Id: I84a565e2e0caa3b76bf291a7d188a57a4b00e1b0 Reviewed-by: Jani Heikkinen <jani.heikkinen@digia.com>
* QtQuick docs: add missing \qmlpropertygroup commandsJ-P Nurmi2013-12-201-0/+1
| | | | | | | "warning: No QML property group command found; using..." Change-Id: Iafbdbc09cbd76bf81a5baf3a5a4fab843778b5cb Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
* Remane private QQuickAction into QQuickStateActionGabriel de Dietrich2013-10-031-25/+25
| | | | | | | | | | | This avoid symbol conflicts when statically linking with Qt Quick Controls, that has its own QQuickAction class and which may become public some day. (QQuickPropertyAction might be a more apt name, but it's already taken). Change-Id: Ia9514d63d38295603a89d8ec5a88815a651380f7 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com> Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
* qdoc: no longer recognizes the version nr in QML refsMartin Smith2013-10-021-16/+16
| | | | | | | | | | All QML references of the form <QML-module-name><QML-module-version>::<QML-type>::<member-name> have had the <QML-module-version> removed i. Task-number: QTBUG-33776 Change-Id: Idde279e0f254cd24ea44f9841662dd81a2c5bbc6 Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* Fix license headers of QtQuick sources.Gunnar Sletta2013-09-301-1/+1
| | | | | Change-Id: I3750c47640bf21c3567c5fa1c4667e3e2552942e Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Doc: Fixed and updated Qt Quick's \qmlmodule pageJerome Pasion2013-09-251-2/+2
| | | | | | | | | | | -incremented version to Qt Quick 2.2 (in \qmlmodule page) -import changed to QtQuick 2.2 -\inqmlmodule no longer needs the version. QDoc will ignore the version but it is better to remove it now to avoid confusion Task-number: QTBUG-32172 Change-Id: I40b52e59667014720be40a35b3a8fb9836825e31 Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* Get rid of the first half of QQmlGuard usageLars Knoll2013-07-051-3/+3
| | | | | | | | | QQmlGuard was being used as a more performant replacement for QPointer. QPointer got now fixed in Qt 5.0, making this class obsolete. Change-Id: I77eef066c4823af4b074ef32d4d78dbd67c36cd0 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-101-1/+1
| | | | | | Change-Id: I6c3bd7bebe3d62d1cfd0fa6334544c9db8398c76 Reviewed-by: Akseli Salovaara <akseli.salovaara@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Renamed QQuickItem::pos property to positionShawn Rutledge2012-11-291-1/+1
| | | | | | | | | Abbreviated property names are less descriptive so we don't have many of them. Might as well be consistent. QWindow::pos was already renamed. Change-Id: Ib52673e68e7dc902b2f8942dba6b899074b2538b Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-231-24/+24
| | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: Ie7f5d49ed8235d7a7845ab68f99ad1c220e64d5c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix potential memory leak in AnchorChanges.Michael Brasser2012-08-271-1/+42
| | | | | | Task-number: QTBUG-24708 Change-Id: I4e24b3859f3881ebea4780872b7e4f3790e42d54 Reviewed-by: Yunqiao Yin <charles.yin@nokia.com>
* Fix uses of various qml doc commandsBea Lam2012-08-081-16/+16
| | | | | | | | | | | | | | Signals documented with \qmlsignal should indicate handler name, i.e. 'onSignal' rather than 'signal'. Methods documented with \qmlmethod do not need to document 'void' return values. Also the name of any documented attribute should be qualified with 'QtQuick2::<qmltype>'. Change-Id: I206dd9e8f39c3b84e029ae9d4101b05d0bfb3478 Reviewed-by: Andrew den Exter <andrew.den-exter@nokia.com>
* Make QQmlScriptString opaque.Michael Brasser2012-08-031-32/+26
| | | | | | | | Allow for future optimization by encapsulating the raw script data. Change-Id: I1863103e8e6d74ede60593cabb240e16f2ae657e Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
* Doc: Changed \qmlclass to \qmltype and added \instantiates.Jerome Pasion2012-07-301-2/+4
| | | | | | | | | | -To simplify QDoc, \qmlclass is now \qmltype. -'\instantiates <C+++ class>' is for the types that are defined in C++. Change-Id: I29242d33daf7b972d8b86a356b9689638866b950 Reviewed-by: Laszlo Papp <lpapp@kde.org> Reviewed-by: Bea Lam <bea.lam@nokia.com> Reviewed-by: Martin Smith <martin.smith@nokia.com>
* Change Quick docs to refer to "types" rather than "elements"Martin Jones2012-07-161-1/+1
| | | | | | Task-number: QTBUG-24785 Change-Id: I223479b879514abaacb123852323c1cfada7a5e1 Reviewed-by: Bea Lam <bea.lam@nokia.com>
* Remove dead code.Michael Brasser2012-06-291-50/+1
| | | | | Change-Id: I2e206d746cc48ff7bab29b2135d03b70f85e39d6 Reviewed-by: Yunqiao Yin <charles.yin@nokia.com>
* Doc: Grouped Qt Quick types into several groupsJerome Pasion2012-06-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -created new groups and converted some overviews into group pages -edited type documentation and added \ingroup -articles still need title fixes and link fixes Groups: qtquick-visual-types qtquick-item-graphics qtquick-shaders qtquick-canvas qtquick-text qtquick-text-validator qtquick-interaction qtquick-positioners qtquick-transformations qtquick-states qtquick-animation-define qtquick-animation-properties qtquick-animation-control qtquick-animation-modifiers qtquick-images-sprites qtquick-images qtquick-models qtquick-containers qtquick-views qtquick-paths qtquick-utility Task: QTBUG-25685 Change-Id: I81d4df3320bf5daad5cabb5e42408013fb24f464 Reviewed-by: Bea Lam <bea.lam@nokia.com> Reviewed-by: Alan Alpert <alan.alpert@nokia.com>
* Fix doc snippets paths and parsing errorsBea Lam2012-05-311-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | qtqml.qdocconf and qtquick.qdocconf now refer to the correct snippets and source directories. Snippet paths in .qdoc and .cpp files have been updated to refer to the new shortened path references, e.g. \snippet qml/file.cpp instead of \snippet doc/src/snippets/qml/file.cpp. This also deletes snippets from src/qml/doc/snippets that belonged under src/quick/doc/snippets (and were already duplicated there anyway) and restores some snippet files that shouldn't have been deleted. Also fixes some inline snippets to use \code .. \endcode instead of \qml .. \endqml as they contained javascript or partial QML snippets that were causing parsing errors from qdoc. There are still snippet errors arising from qmlintro.qdoc as the qmlintro snippets directory that it refers to cannot be located. There are also two references to a removed snippet identifier in examples/qml/cppextensions/plugins/plugin.cpp that need to be fixed in conjunction with the related docs in a later commit as the relevant code has changed and the docs are now invalid. Task-number: QTBUG-25721 Change-Id: I50c665245a74c140470c58a32546591d187dfe4b Reviewed-by: Chris Adams <christopher.adams@nokia.com>
* Doc: Sanitized QML typesNico Vertriest2012-05-241-2/+2
| | | | | | | | | | -modified \brief -checked QML modules -added qml directory to the qdocconf file -added particles directory to the qdocconf file Change-Id: I589e32d3106cda37c7fa4d55a941afd9876fc2b2 Reviewed-by: Geir Vattekar <geir.vattekar@nokia.com>