summaryrefslogtreecommitdiff
path: root/src/quick/util
Commit message (Collapse)AuthorAgeFilesLines
* doc: Clarify usage of palette; testable snippetsShawn Rutledge2023-05-171-2/+2
| | | | | | | | | | | | | | | | | - color groups are better shown with copyable monospace syntax rather than capitalized - clarify that using palette grouped-property syntax does not imply that you must define every color - Window has a palette property, inited from SystemPalette: it's not only ApplicationWindow - testable snippets - reuse part of the windowPalette snippet for the Window.active property (switching colors might be the main use case) - make more links Pick-to: 6.2 6.5 Change-Id: I5974351ba66fc9aeec34cb6a4aba1eb85289f536 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* qquickwindow: Clear hover when a window is hiddenDavid Edmundson2023-04-252-0/+8
| | | | | | | | | | | | | | | | | This fixes a bug in the following sequence: - user opens a window - the window is hidden whilst under the mouse - later the window is reopened without the mouse being under the window - with the lastMousePosition set an item underneath where the mouse used to be gets activated. On X11 we get a Leave event for the hidden window, this is not true for wayland. Pick-to: 6.5 Change-Id: Ib14e8dbe29f1ad9a71a488b671d226be1d017b8d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Use correct names for QEventPoint::State, PointerDevice::GrabTransitionShawn Rutledge2023-04-142-17/+19
| | | | | | | | | | | | | | | | | | | | | | | | | Qt::TouchPointState is not the actual type here, and we should not encourage e.g. making a comparison between eventPoint.state and Qt.TouchPointMoved in an onGrabChanged handler. The equivalence is an internal detail; and eventPoint can come from any pointing device, not only from a touchscreen. QEventPoint is a Q_GADGET; we keep the registration to expose it as a value type (eventPoint). But such types cannot be created in QML, and we also need to give it an uppercase name to scope the enum values that it declares: that's a new foreign namespace called EventPoint. So it's possible to compare an eventPoint instance's state property against EventPoint.Pressed, and so on. Also show complete QML syntax in the \value tables where PointerDevice::GrabTransition is emitted to QML, namely PointerDevice::grabChanged and PointerHandler::grabChanged. Amends b43a873264d012dc0a0e574ea53335a40af8aa38 Task-number: QTBUG-102160 Change-Id: If1a97f21d8e005e3692298b8512f7f8b56a92c97 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Correctly discover metaType for UntypedProxyPropertyMikolaj Boc2023-04-051-1/+1
| | | | | | | | | | | | | | | | | When attempting to set two behaviors on the same property, the second behavior's target property gets intercepted by the first behavior. Then, meta type for UntypedProxyPropertyBindable in UntypedProxyProperty's ctor will not be discovered correctly, since UntypedProxyPropertyBindable interface's metaType is explicitly set to nullptr. Use QUntypedBindable::metaType instead to access MetaTypeAccessorFlag via iface->getter. A warning shall also be reported in case two or more interceptors are set on the same property. Fixes: QTBUG-98896 Change-Id: Ie38ae75235e000e25a60a1c2ccaad70a46f5018e Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Improve QQuickAnimator::transition warning messageMitch Curtis2023-04-041-1/+2
| | | | | | | | | Use qmlWarning and actually print the conflicting property names. Task-number: QTBUG-111570 Pick-to: 6.5 Change-Id: I194e05d3d5a4d65d7a12dcff3318f7ec07ad075d Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* doc: Use \value rather than \li for enumeration values and constantsShawn Rutledge2023-03-289-72/+66
| | | | | | Pick-to: 6.2 6.5 Change-Id: Ica8354a53d0a5fb5dd1d8cd5f774dcdc56b6f99a Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Introduce a new feature: quick-pixmap-cache-threaded-downloadMikolaj Boc2023-03-201-24/+47
| | | | | | | | | | | | | | | | The new feature replaces USE_THREADED_DOWNLOAD in qquickpixmapcache. Some code has been removed when it is not used: - eventLoopQuitHack - not needed as event loop is not used with the feature off - mutex - thread synchronization measures are not needed if threads are not used Also, perform last job housekeeping in ~QQuickPixmapCache sync with threaded downloads disabled. Change-Id: Ic67385c94bbe403ed0544e78f30e7c237b4f4a95 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Make thread affinity apparent in QQuickPixmapCacheMikolaj Boc2023-03-171-49/+114
| | | | | | | | | | | | | | | Introducing a new name for the former QQuickPixmapReaderThreadObject: ReaderThreadExecutionEnforcer, which describes its (sole) purpose, as opposed to the former. Added a thread affinity marker to check threading assumptions in QQuickPixmapReaderThreadObject. Also made an alias for the event ReaderThreadExecutionEnforcer sends to trigger processJobs on the original reader on its thread. Change-Id: I022374775eaa417f8568a7297b44b028db7ff0ee Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Rename cancelled -> cancelledJobs in QQuickPixmapCacheMikolaj Boc2023-03-171-16/+16
| | | | | | | | Thus improving readability, as cancelled might be confused with a cancellation flag. Change-Id: Ib7b24e58458e138ca1f653d5342e3d00f01a0f96 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Add MethodIndex to meta method index statics in QQuickPixmapCacheMikolaj Boc2023-03-161-29/+36
| | | | | | | | Thus improving readability, as the fields won't be confused with actual methods. Change-Id: I7ff390fffd97042180bc6d9321fb967569e67a93 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Use mutex locker in QQuickPixmapReaderMikolaj Boc2023-03-161-49/+49
| | | | | | | | Transition to the QMutexLocker for a more fail-safe and idiomatic approach to locking the mutex Change-Id: I97cfb05e8bddfd4c67b14b1db6bc457eb8e6d4c9 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QQuickPixmapCache: own thread object if not using threaded downloadMikolaj Boc2023-03-151-21/+47
| | | | | | | | | | If threaded download is not used, we rely on async callbacks to drive the download. We can also safely own the thread object since all operations are executed on exactly one thread. Fixes: QTBUG-111892 Change-Id: I17f927f383f7a3a28d26a128b3f9e7ce1dbfe8be Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Doc: mention the order in which top-level transition animations are runMitch Curtis2023-03-011-0/+5
| | | | | | | | | | | | This is mentioned in the documentation for the transitions property and in "Playing Animations in Parallel or in Sequence", but is easy to miss if you only read the detailed description. It's an important detail that users should know, so add it. Pick-to: 6.5 6.2 Change-Id: I6f074506ddc8a7b02e6114741d9fadef48cdc8ab Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Doc: fix grammar of PropertyAnimation section titleMitch Curtis2023-03-011-1/+1
| | | | | | | | | | | Also use sentence case while we're at it. Amends 44dd79eedae174af3474f6317327a09af0de177a. Pick-to: 6.5 6.4 Change-Id: I7cbc35bde6f398c4b774627a6f214e302e620efa Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
* doc: Add qml PointerDevice, pointingDeviceUniqueId and PointerEventShawn Rutledge2023-02-281-1/+1
| | | | | | | | | | | | We need a link target for the GrabTransition enum argument in the PointerHandler::grabChanged QML signal doc, and a few other places. Fix warnings about failing to link in a couple of places. Pick-to: 6.2 6.4 6.5 Fixes: QTBUG-102160 Task-number: QTBUG-104761 Change-Id: I92a544d363a6ff9e990c7d56c110bc5db1202bb3 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Add cast operators to all our "extended" value typesUlf Hermann2023-02-241-0/+16
| | | | | | | | | This way you can use their Q_INVOKABLE ctors to create the original types. This will be used in the C++ code qmlcachegen generates. Task-number: QTBUG-108789 Change-Id: If792f07ef082166042bcc03be09e2d3e53297ce3 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* doc: Rename QML type HandlerPoint to handlerPointShawn Rutledge2023-02-171-0/+1
| | | | | | | | | | | | | | It's a Q_GADGET value type so it needs a lowercase name. Link eventPoint to handlerPoint to help reduce confusion. There's already a link in the other direction. Pick-to: 6.2 6.4 6.5 Task-number: QTBUG-104761 Task-number: QTBUG-104570 Change-Id: I962d2d44690ec2f75190e07be7489eb3883d0657 Reviewed-by: Sami Shalayel <sami.shalayel@qt.io> Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QQuickDeliveryAgent: fix downcast to QQuickItemVolker Hilsheimer2023-02-101-32/+25
| | | | | | | | | | | | None of the code should run if the item is not a QQuickItem, do downcast only once using qmlobject_cast for the entire block. As a drive-by, simplify the code a bit. Pick-to: 6.5 6.4 Change-Id: Ib3bc511022053889149d2fca62c6674c09409606 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Fix build with -no-feature-texthtmlparserTasuku Suzuki2023-02-081-0/+2
| | | | | | Pick-to: 6.5 Change-Id: Icdfe5950e5f8f7f03aba36bd1058d0cd6c6df7ac Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QtQuick: Fix conflicting definitions of qsg_leak_check in CMake Unity ↵Friedemann Kleint2023-02-071-5/+2
| | | | | | | | | | | (Jumbo) builds Make it a properly prefixed global variable. Pick-to: 6.5 Task-number: QTBUG-109394 Change-Id: Ia09072bf6603c3566484f5361b03f1d3a2164be3 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* QQuickPixmapCache: Avoid cross-thread deletion of QObjectsUlf Hermann2023-01-251-9/+40
| | | | | | | | | | | | | The threadObject is not actually owned by the the class, but rather by the thread that creates it. Make sure to delete it in the same thread. Amends b94bbd7a0b032eb6428d44bfb86feac577786a1f Pick-to: 6.5 Fixes: QTBUG-110590 Change-Id: I59d0175cf558ab3523c03a288668e1876b7329e8 Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Fix build with -no-feature-quick-shadereffectTasuku Suzuki2023-01-245-0/+14
| | | | | | | | | | | Changes the feature from PRIVATE to PUBLIC to disable the private layer property in qquickitem.h. Disables UniformAnimator and Item::layer. Fixes missing headers seen by disabling the feature. Pick-to: 6.5 Change-Id: I9025568c5d98cb708ed2fcfb323ac33c06c2ccaf Reviewed-by: Kaj Grönholm <kaj.gronholm@qt.io>
* Fix Animators in case of node recreateThomas Senyk2023-01-121-2/+3
| | | | | | | | | | | | Those node recreations happen when the RHI backend is recreated. One such case is GLX_NV_robustness_video_memory_purge In such cases QQuickTransformAnimatorJob::invalidate() will be called, however the node will never be re-set Pick-to: 6.5 6.4 6.2 Change-Id: I3136c220f41781689f4a271caf0543a3b659447c Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* QQuickFlickable: add internal doc commentsOliver Eftevaag2023-01-031-6/+11
| | | | | | | | | | | The codebase around qquickflickable and qquicktimeline is not very intuitive to read for people that are not already familiar with it. This patch is an effort to improve the readablility to some degree. Pick-to: 6.5 Change-Id: Ie8082040156323ba6b316d4a8800a15c50caaed2 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QQDAPrivate::deliverUpdatedPoints: skip HoverHandlers if wheel eventVladimir Belyavsky2022-12-172-0/+6
| | | | | | | | | | | | | This complements 85db031c3f449cbeba41eb5667cf6725cca8b32d. When delivering a mouse wheel event, we shouldn't just pass it to the item's HoverHandler, because those are normally visited in QQuickDeliveryAgentPrivate::deliverHoverEventToItem(). Pick-to: 6.4 6.5 Fixes: QTBUG-108600 Fixes: QTBUG-108601 Change-Id: Ie6066807f80140e1007347413f1095f98f6cb5c0 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QQuickStates: Handle more types as result of whenFabian Kosmale2022-12-151-5/+4
| | | | | | | | | | | | | | | | | When calling QQmlBinding::evaluate(), we get a generic QVariant back, and no conversions from the evaluation result to bool are done at that point. Consequently, we would need to mirror the engines conversion from arbitrary values to bool. Doing that manually is rather fragile, so we instead use the QMetaType based overload, which already takes care of the conversion. That requires making the overload public. As qmlsc is already using that overload from within evaluate, it was not affected by the bug. Fixes: QTBUG-108024 Pick-to: 6.2 6.4 6.5 Change-Id: I3d5ee8f886ea6ada44fc8182300f3472cb1efc3c Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Don't override exclusive touch grab of filtered itemVolker Hilsheimer2022-12-141-2/+5
| | | | | | | | | | | | A parent that filters mouse/touch events for a child might make the child the exclusive grabber of the touch point when filtering, and the child might have the keepTouchGrab property set. In that case, don't override the exclusive grabber with the filtering parent. Task-number: QTBUG-105312 Pick-to: 6.5 6.4 6.2 Change-Id: Ic04513987d5ecb2cd0b12939b7d66091e85b35ee Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Doc: Fix incorrect \inqmlmodule statementsTopi Reinio2022-12-121-1/+1
| | | | | | | | | | | | | | | CloseEvent: Refers to an undocumented module QtQuick.Window which is now an alias to QtQuick import. ImputMethod: Trailing full stop in the module name. These were not caught by documentation testing in the CI because of a bug in QDoc where \inqmlmodule <module> did not output a warning if <module> was undocumented. Pick-to: 6.4 Change-Id: Ifd087f6d2ec5c32bd69700b7b131581895da26d0 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Expose QMatrix mapping functions to JS spaceDavid Edmundson2022-12-072-0/+13
| | | | | | | | | | When using a matrix in JS code, being able to map points and rectangles through it is a reasnoble task. We have everything available in the C++ side just not exposed. Change-Id: I64cc3f0b5fef8eeabc618dad24de19321a96b2fc Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Clean QQuickPixmapReader::processJob dead codesJiDe Zhang2022-12-051-2/+1
| | | | | Change-Id: Id0d8c6538d2648bb9fb345202486872be933e074 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Don't clearPassiveGrabbers() after MouseEventSynthesizedBySystemShawn Rutledge2022-11-182-0/+6
| | | | | | | | | | | | | | | | Windows sends synth mouse events after touch events. We avoid delivery of them in QQuickDeliveryAgentPrivate::handleMouseEvent(), but we need to avoid reacting to them here too. If the touchpoint already had a passive grabber, and the mouse event comes from the same device, then clearing the mouse passive grabbers is identical to clearing the touchpoint's passive grabbers, which we don't want to do. Amends 48b1c59b65332b773eb51d25c422b53dbd3d6762 Pick-to: 6.4 6.2 Fixes: QTBUG-104890 Change-Id: I4c3e18fc834c7bfcba7037548c7e42627e319bda Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Add FOREIGN declaration for QEventPointSami Shalayel2022-11-112-0/+76
| | | | | | | | | | | | Add a foreign declaration to QEventPoint such that qml compilers can work correctly with it. Also fix the links to eventPointer in the documentation, and duplicate the list of properties of the C++ api. Fixes: QTBUG-107624 Change-Id: I11c4a4a416a40d40fc7ce45d7f894406035a6d87 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Fix performance issue with drag retrigger events for qtquick itemsSanthosh Kumar2022-11-071-11/+25
| | | | | | | | | | The items that reject drag events (specifically onEntered in DropArea) should not be retriggered with DragEnter event until entered once again. Fixes: QTBUG-74496 Pick-to: 6.4 6.3 6.2 5.15 Change-Id: I241a6004da6382685be89fe8a001b98dfde5c8a2 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* DA: don't ignore subtreeHoverEnabledRichard Moe Gustavsen2022-11-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current hover delivery logic in the DA was currently only taking subtreeHoverEnabled into account for disabled items. This meant that subtreeHoverEnabled was in practice undermined by the DA, and resulted in far too many items in the scene being visited. Moreover, according to tst_HoverHandler::hoverHandlerOnDisabledItem(), and QTBUG-30801, we should always deliver hover events to disabled items. This patch will therefore change the test, so that we always check if subtreeHoverEnabled is set before we recurse into the child. Whether or not the item is enabled or disabled is not relevant, and therefore removed. This will ensure that we e.g don't visit all the delegate items in a TableView for each pointer move, just because TableView itself subscribes to hover (unless the delegate is also subscribing to hover). Note: This patch is only an optimization, and shouldn't affect which items and handlers we end up actually delivering hover events to. It will only stop the DA from recursing into too many items. Amends 831efa14e91cfa358e57a32197578d41c2ae1b24 Pick-to: 6.4 Change-Id: I6ddf963c3ac99ef54da08f64dc5660bc35a295e0 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Don't accept all QTouchEvent::points unless the item accepts touchBumjoon Park2022-10-281-8/+6
| | | | | | | | | | | | | | | | | | An items that handles touch events can accept multiple touchpoints; but after visiting an item that does not handle events at all, or that relies on synth-mouse events, let the remaining touchpoints continue propagating. Do not automatically accept all touchpoints just because an item accepted a synth-mouse event, and do not auto-grab other touchpoints besides the touchmouse point. Done-with: Shawn Rutledge Pick-to: 6.2 6.4 Fixes: QTBUG-107867 Change-Id: I6c342487a4f8bacbd84e6d7e0e7c00884791a610 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Allow OS-synthesized right clicks to be deliveredShawn Rutledge2022-10-261-1/+17
| | | | | | | | | | | | | | | | | Since 15337aa91b891b49ffe76c96dd6fa6cd9bead2c2 we have been blocking all OS-synthesized mouse events. But synthesizing right click from long- press is becoming more common, so Qt Quick should be able to react to those. [ChangeLog][QtQuick] In case your operating system synthesizes a right-click from a touchscreen long-press, synthetic right-button mouse events are now delivered normally, so that e.g. TapHandler can react. You can opt out by setting QT_QUICK_ALLOW_SYNTHETIC_RIGHT_CLICK=0. Fixes: QTBUG-77902 Task-number: QTBUG-84179 Change-Id: I609041daf0e3e8ce1d1f3b0c78ae3bd264fec8a3 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Propagate ShortcutOverride events up the parent chainVolker Hilsheimer2022-10-261-8/+11
| | | | | | | | | | | | | | | | | | | | | As with key events, ShortcutOverride events have to propagate up the parent chain so that parent items can override shortcuts with their own key handling. For that to work, items that implement shortcutOverride but don't handle the event must explicitly ignore it, as the events, like all input events are accepted by default. This revealed that QQuickTextEdit (via QQuickTextControl) and QQuickTextInput did not correclty ignore unhandled shortcut overrides, so fix those implementations. As a drive-by, explicitly capture the event parameter in the QML test's signal handler. Task-number: QTBUG-107703 Pick-to: 6.4 Change-Id: If38469c000733f53f5f936de38869b3b6f9fb07a Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Don't used threaded pixmap downloads on WASMMikolaj Boc2022-10-221-5/+12
| | | | | | | | | | | | | | WASM sockets rely on async callbacks that won't arrive when a thread is waiting on a condition in QEventDispatcherWasm::wait. The thread deadlocks, as the condition will not ever be signaled, since that relies on the async callback from emscripten_fetch being issued. Because WASM networking is non-blocking anyway, we forgo using the threaded download altogether. Change-Id: Ic75bcf7dd6272a6d3ea7b934807fcc74458b13ba Fixes: QTBUG-106159 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Use a smart pointer for threadObject in pixmap cacheMikolaj Boc2022-10-201-13/+8
| | | | | | | This enables us to forgo manual object lifetime control. Change-Id: I50894d685d98eae8b18d49c52eafa66984a8429f Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* qquickpointerhandler_p.h: Clean up includesFabian Kosmale2022-10-191-0/+1
| | | | | | | | | | | | | | | | | The referenced bug report specifically complained about warnings caused by including qquickpointerhandler_p.h. All of those -Wshorten-64-to-32 warnings come from headers that aren't strictly needed for qquickpointerhandler_p, though. So fix the issue by only including what is actually need, which also slightly improves compile times. This requires adding a few transitive includes in select places. As a drive-by, remove the unneeded QML_DECLARE_TYPE. Fixes: QTBUG-105055 Change-Id: I24d78e7131771a4bbcb402e6838a5a9a11abbbec Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Port from container::count() and length() to size() - V5Marc Mutz2022-10-136-21/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a semantic patch using ClangTidyTransformator as in qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8, but extended to handle typedefs and accesses through pointers, too: const std::string o = "object"; auto hasTypeIgnoringPointer = [](auto type) { return anyOf(hasType(type), hasType(pointsTo(type))); }; auto derivedFromAnyOfClasses = [&](ArrayRef<StringRef> classes) { auto exprOfDeclaredType = [&](auto decl) { return expr(hasTypeIgnoringPointer(hasUnqualifiedDesugaredType(recordType(hasDeclaration(decl))))).bind(o); }; return exprOfDeclaredType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes)))); }; auto renameMethod = [&] (ArrayRef<StringRef> classes, StringRef from, StringRef to) { return makeRule(cxxMemberCallExpr(on(derivedFromAnyOfClasses(classes)), callee(cxxMethodDecl(hasName(from), parameterCountIs(0)))), changeTo(cat(access(o, cat(to)), "()")), cat("use '", to, "' instead of '", from, "'")); }; renameMethod(<classes>, "count", "size"); renameMethod(<classes>, "length", "size"); except that on() was replaced with a matcher that doesn't ignoreParens(). a.k.a qt-port-to-std-compatible-api V5 with config Scope: 'Container'. Change-Id: I58e1b41b91c34d2e860dbb5847b3752edbfc6fc9 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Port from qAsConst() to std::as_const()Marc Mutz2022-10-079-27/+27
| | | | | | | | | | | | | | We've been requiring C++17 since Qt 6.0, and our qAsConst use finally starts to bother us (QTBUG-99313), so time to port away from it now. Since qAsConst has exactly the same semantics as std::as_const (down to rvalue treatment, constexpr'ness and noexcept'ness), there's really nothing more to it than a global search-and-replace. Task-number: QTBUG-99313 Change-Id: I601bf70f020f511019ed28731ba53b14b765dbf0 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Port from container::count() and length() to size()Marc Mutz2022-10-0715-106/+106
| | | | | | | | | | | | | | | | | | | | 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>
* Doc: fix FrameAnimation's frameTime snippetMitch Curtis2022-09-301-2/+3
| | | | | | | | | | | | | Add to rotation instead of assigning so that the Rectangle actually rotates. While we're at it, slow down the rotation so you can see that it's smooth and center the Rectangle so its edges aren't out of view when it rotates. Pick-to: 6.4 Change-Id: I126b00e4b28b9ee79889d0b5c274c9f0ee58a3ec Reviewed-by: Kaj Grönholm <kaj.gronholm@qt.io>
* Fix build with disabled accessibilityAlexey Edelev2022-09-291-2/+3
| | | | | | Task-number: QTBUG-106941 Change-Id: I3c442452fee8e4c0b78fb7a615a005e1b89383d1 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Clear delivery agent delegated focusJere Tuliniemi2022-09-271-1/+5
| | | | | | | | | | | | | | | | | When focus was delegated, the focused item would remain as an active focus item in the delivery agent after deletion. Further use by the delivery agent would then cause a crash. But since 543598a6cc07d67e7651c9f65c058465ea6d8425 the intention is that the window's DA's activeFocusItem is the one that counts (if there is only one keyboard, there can be only one place to type text; and incoming events will visit the window's DA first.) So any time we clear focus, the window's DA has to clear it, just as setFocusInScope() delegates to the window's DA. Pick-to: 6.4 6.2 Fixes: QTBUG-105192 Change-Id: Iec8c6c67ff18b5dac5ec13fcced6e3fe30423c14 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Allow more options for creating value types from JS objectsUlf Hermann2022-09-242-0/+14
| | | | | | | | | | | | | | | | | | | | We allow value types to be created 1. by calling Q_INVOKABLE constructors 2. by setting their values from properties of a JS object Both have to be opted into by setting a class info. If opted into, these options override the existing methods. When a a type can be created by setting its properties, that implies you can also initialize it using an invokable constructor. However, when given a JS object, the properties method is used. We keep this internal and undocumented for now. As the last try (the create(QJSValue) methods and QJSValue ctors) was not that stellar, let's first wait a bit and see if we're getting it right this time around. Fixes: QTBUG-106480 Change-Id: I767230924afcba032d501846cc3263dad57b7bf0 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* DA: don't exit early from deliverHoverEvents when we have hovered itemsRichard Moe Gustavsen2022-09-201-6/+11
| | | | | | | | | | | | | | | The current implementation would exit early if subtreeHoverEnabled was false. The problem is that this can also happen if you set hoverEnabled to false while an item is being hovered. And in that case, we need to prune the list of hovered items. This patch will therefore ensure that we only exit early if subtreeHoverEnabled is false, _and_ no items are currently marked as being hovered. Pick-to: 6.4 6.2 Change-Id: I6086c7cbea07b0973db343a3f439810361c5d1b7 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* DA: Avoid corrupting persistent scenePosition in QHoverEvent ctorShawn Rutledge2022-09-201-4/+7
| | | | | | | | | | | | | | | | | | | | It's important to set lastMousePosition with the correct scene position in QQuickDeliveryAgent::event's QEvent::Enter case, not some item-localized position. The QHoverEvent ctor takes two points: pos and globalPos; pos is then passed as both the scene and global pos to the QSinglePointEvent ctor, which calls QMutableEventPoint::setScenePosition() on the persistent QEventPoint instance and then detaches befeore setting ephemeral state. Therefore, we must construct QHoverEvent with scene position first, not local position, so that the right value is persisted (or actually left unchanged in this case); it's better to set local position after the detach(), whereas it's too late to fix the persistent point then. Pick-to: 6.4 6.2 Fixes: QTBUG-35409 Change-Id: Ibe840f8ac7b91fd711fc0f4d4a90a24e0117791b Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* DA: ignore disabled HoverHandlers when delivering hover eventsRichard Moe Gustavsen2022-09-161-11/+29
| | | | | | | | | | | | | | | | | | | | | According to the documentation for HoverHandler::enabled, a disabled hover handler will not accept any mouse events. It therefore follows naturally that a disabled HoverHandler should also not affect event propagation elsewhere. This patch will change the implementation, so that we don't deliver hover events to HoverHandlers that are disabled. This also means that disabled HoverHandlers will no longer block propagation to its siblings. [ChangeLog][QtQuick][HoverHandler] Disabled hover handlers will no longer receive hover events, or block siblings from being hovered. Pick-to: 6.4 6.3 6.2 Fixes: QTBUG-106548 Change-Id: I7f2e459ba39f1e23cdb13bf94f8754e185dcd0c1 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>