aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickitem.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/dev' into wip/pointerhandlerShawn Rutledge2017-08-081-0/+16
|\ | | | | | | Change-Id: I0af7b0c3e0a21aae68c82ec11c5ca579c1661ce9
| * Add QQuickItem::ItemEnabledHasChangedJ-P Nurmi2017-07-111-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The itemChange() method has been very useful for Qt Quick Controls 2 to efficiently react to various item changes, but a notification for the enabled state was missing, so it always had to be handled as a special case using signals and slots. This change allows QQC2 to handle enabled state changes the same way e.g. visibility changes are handled. It's also nice to be able to update a control's internal state before the actual notifier signal is emitted. [ChangeLog][QtQuick][QQuickItem] Added a ItemEnabledHasChanged value to the ItemChange enum. QQuickItem::itemChange(ItemEnabledHasChanged) gets called when the item's effective enabled state has changed. The new enabled state is stored in ItemChangeData::boolValue. Change-Id: Iae96ec21f2b94f453632282473decd1c66097a75 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Robin Burchell <robin.burchell@crimson.no>
* | Merge remote-tracking branch 'origin/dev' into wip/pointerhandlerJan Arve Saether2017-07-111-37/+54
|\| | | | | | | | | | | | | | | | | | | | | Conflicts: examples/quick/shared/LauncherList.qml src/quick/items/qquickevents.cpp src/quick/items/qquickevents_p_p.h src/quick/items/qquickwindow.cpp tests/auto/quick/touchmouse/tst_touchmouse.cpp Change-Id: Id692d291455093fc72db61f1b854f3fc9190267b
| * Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-06-071-37/+54
| |\ | | | | | | | | | Change-Id: I61ab3d0bd8cc02f640c60c037226eace09ec09ba
| | * Merge remote-tracking branch 'origin/5.9.0' into 5.9Liang Qi2017-05-311-37/+53
| | |\ | | | | | | | | | | | | Change-Id: I3f77593ca944114534fff5df26bbb09150ee4400
| | | * Revert "QQuickItem: Port a number of manual loops to range-for"Robin Burchell2017-05-191-37/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 8d92e595e0e8cf19f60db2fce4a543265c9130e9. This is broken in a few places, e.g. setEffectiveVisibleRecur emits, which means that it may run uncontrolled code, so we can't be sure the list isn't altered underneath us. Change-Id: I58b8b62e74581207c1b14902ea7b8b552761de8a Task-number: QTBUG-58811 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
| | * | Document the default value of x, y, width & heightJesus Fernandez2017-05-231-0/+1
| | |/ | | | | | | | | | | | | | | | | | | | | | The default values of the coordinates and size variables were missing. Change-Id: I1bba77b3db68d3f726c1211c6a0090e97f687b51 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | | Start over with event delivery when touchpoint releases occurShawn Rutledge2017-05-221-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new rule is that when the number of touchpoints changes, we start over with event delivery as if the touch had just begun, to give more opportunities to hand off processing from one item or handler to another. And MultiPointTouchArea can now handle the handoff: for example in tests/manual/pointer/pinchDragFlingMPTA.qml when the user is pressing three fingers, the PinchHandler is active; when the user then lifts one finger, the MPTA can resume handling the two remaining touchpoints as if they were just pressed. The change in QQuickMultiPointerHandler::wantsPointerEvent is both a behavior change and an optimization: released points aren't eligible; but if some points are released, then pressed, updated and stationary points are all eligible. And, figure this out without looping over the points twice. Change-Id: I26b7593de8e72b471adfec4a4482dd87a8288442 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* | | Default QQuickItem::acceptTouchEvents to true until Qt 6Shawn Rutledge2017-05-101-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | This is a partial revert of 1457df74f4c1d770e1e820de8cd082be1bd2489e to avoid making a mandatory API change so soon. Change-Id: I05040579fa36d3dc5ef7616861f6d17adf500d2c Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | | Merge remote-tracking branch 'origin/dev' into wip/pointerhandlerShawn Rutledge2017-05-081-15/+19
|\| | | | | | | | | | | Change-Id: Ia06843de255547174efa556b1ab76be4b4be4287
| * | Merge remote-tracking branch 'origin/5.9' into devLars Knoll2017-05-021-0/+2
| |\| | | | | | | | | | Change-Id: I71275a2076c3d32ee2896571be882067320a2e9e
| | * Run includemocs in qtdeclarativeThiago Macieira2017-04-261-0/+2
| | | | | | | | | | | | | | | Change-Id: I84e363d735b443cb9beefffd14b8c023a37aa489 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
| * | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-04-211-0/+2
| |\| | | | | | | | | | Change-Id: Ibed6ee74d36b4ce37391c82db00a0abd30d09e7a
| | * Fix warning for -no-feature-cursorStephan Binner2017-04-181-0/+2
| | | | | | | | | | | | | | | Change-Id: Idc2ab95d0ea1e556995e7bcd29b5cbcd82bc28f6 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * | QQuickContents: Use QRectF rather than reinventing itRobin Burchell2017-04-171-15/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | No major impact on benchmarks -- if anything, this improves the new delegates_item_childrenRect by 2-3 frames. Change-Id: I50fef6f0bc9531eabd1d42079886dca754e1ce2a Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Michael Brasser <michael.brasser@live.com>
* | | PointerHandler: add wants/declines logging to qt.quick.handler.dispatchShawn Rutledge2017-04-271-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | and remove the similar "delivering to" log from QQuickItem. It's more useful to know whether delivery will continue rather than simply that we made an attempt. Change-Id: I58c37fb50d4d0c99ef6aa68662ab304194b6d128 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* | | Add QQuickItem acceptTouchEvents/setAcceptTouchEvents; require for touchShawn Rutledge2017-04-141-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It has been suboptimal to speculatively deliver touch events to Items which are not interested; even worse is when we must deliver to a parent item which is filtering events, when the child Item will not accept the touch event anyway. So now it is required that any QQuickItem subclass which wishes to accept touch events must call setAcceptTouchEvents(true) (typically in its constructor). If it does not do this, it will not get any touch events (and this saves us the trouble of looking for parents which filter touch events, too). It is consistent with needing to call setAcceptHoverEvents() to get hover events, and setAcceptedMouseButtons() to get mouse events. [ChangeLog][QtQuick][QQuickItem] When subclassing QQuickItem, it is now required to call setAcceptTouchEvents(true) if you need the item to receive touch events. Change-Id: Idc76c04f4e7f1d4a613087e756e96dac368f4f23 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | | Merge remote-tracking branch 'origin/dev' into wip/pointerhandlerShawn Rutledge2017-04-131-6/+25
|\| | | | | | | | | | | Change-Id: Ie2894830470a69827d4ace3d8af9bee971e3fbd4
| * | Separate the stack used for GC from the regular JS stackLars Knoll2017-04-071-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | This is required to be able to implement concurrent or incremental garbage collection. Change-Id: Ib3c5eee3779ca2ee08a57cd3961dbcb0537bbb54 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * | Expose QQuickItem::size() and document QQuickItem::setSize()Gunnar Sletta2017-03-201-2/+21
| | | | | | | | | | | | | | | | | | | | | [ChangeLog][QtQuick][QQuickItem] Add QQuickItem::size() and document QQuickItem::setSize(). Change-Id: I6f4d531e046758eb062111d656cc2e0be1624da3 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | | Merge remote-tracking branch 'origin/dev' into wip/pointerhandlerShawn Rutledge2017-03-021-4/+46
|\| | | | | | | | | | | Change-Id: I7e43a0a47d49de38617f6afc7548f9a9e212a851
| * | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-03-021-4/+6
| |\| | | | | | | | | | Change-Id: I6cbd83b61fac34c2ba6936711289ec09a490719a
| | * Merge remote-tracking branch 'origin/5.8' into 5.9Liang Qi2017-02-241-4/+6
| | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qv4ssa.cpp src/quick/accessible/qaccessiblequickview_p.h src/quick/items/qquickmousearea.cpp src/quick/util/qquickanimatorjob.cpp tools/qmlplugindump/main.cpp Change-Id: I84474cf39895b9b757403971d2e9196e8c9d1809
| | | * Fix build without features.cursorStephan Binner2017-02-201-2/+4
| | | | | | | | | | | | | | | | | | | | Change-Id: I20821e5fd4d2154aa49ef90015d512dd09c134f3 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| | | * Minor wording issues and typo fixes in docsFrederik Schwarzer2017-02-151-2/+2
| | | | | | | | | | | | | | | | | | | | Change-Id: I60af106607dca02fafc1df2d21d16053d64742b6 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
| * | | Add samples property for Item.layer and ShaderEffectSourceLaszlo Agocs2017-02-231-0/+40
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | [ChangeLog][Qt Quick] Added the properties ShaderEffectSource.samples and Item.layer.samples to allow requesting MSAA rendering of an item subtree, without enabling multisampling for the entire scene. Task-number: QTBUG-58945 Change-Id: I9102cfabba10d4dc1e7ad2aa0b258ada6d9a5a47 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* | | clarify further exclusive vs. passive grabsShawn Rutledge2017-02-201-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add documentation to the grab-related event and eventpoint methods. Rename "grabber" functions which relate only to the exclusive grab, in cases where it would otherwise be ambiguous. And a few other documentation changes. Change-Id: I1a203c8c06a19d4abdb000f08b387c38341ef476 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* | | QQuickWindow: use QVector eventDeliveryTargets to avoid repeated deliveryShawn Rutledge2017-02-071-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If no handler or item accepts a newly-pressed point, the event will be re-delivered in deliverTouchEvent(). It doesn't make sense to re-deliver to the same handlers though. A temporary QSet isn't cheap to create, whereas it seems we will need to keep track of handlers which have already been visited, in order to avoid visiting passively-grabbing handlers multiple times. Since both a QVector and a QSet are heap-allocated, and we expect to have a limited quantity of handlers grabbing at one time, a retained QVector (cleared between events) seems to be the cheapest data structure. Change-Id: I831e9a2576b2fcb9095e065795f2baff58115a49 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* | | QQuickWindow: deliver updates to handlers even if they don't grabShawn Rutledge2017-02-021-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The "weak grab" concept depends on this. First we deliver to grabbers, then we deliver to non-grabbing handlers (but not to non-grabbing items). Avoid re-delivering to grabbing handlers which already received the same event. Change-Id: If51e1cd9372e3bed1daea3758e9ef8e37c0ba5e3 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* | | Merge remote-tracking branch 'origin/dev' into wip/pointerhandlerShawn Rutledge2017-01-261-5/+5
|\| | | | | | | | | | | Change-Id: I7962fd2282792c43af69784c8e98fb050fd928a7
| * | Quick: Remove last foreach, and mark QT_NO_FOREACHRobin Burchell2017-01-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Longer term, we should QT_NO_FOREACH .qmake.conf, but a number of other parts of the codebase still use foreach. Change-Id: I105cdbe2a64ae40ffa53d3aaa8765b09195af841 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * | 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>
* | | Don't assume that target is the parent itemJan Arve Saether2016-12-291-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To summarize: A pointer handler always gets its pointer events from its parent item. It applies its effect (drag, pinch, ...) on the item referenced to by the target property. By default, target refers to the parent, but that is not always the case. In addition to this we also have to handle the case when the target is null Change-Id: If62108abf0aeb713906bf88472ad9a32a74efff6 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | | Merge branch remote-tracking branch 'origin/dev' into wip/pointerhandlerShawn Rutledge2016-12-201-108/+194
|\| | | | | | | | | | | Change-Id: I9ed2e696108f11c9153012fcf092541fd0e0d7c8
| * | Keys: add shortcutOverride signalMitch Curtis2016-12-181-0/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows an item to accept the shortcutOverride event, preventing e.g. Shortcut from stealing key events. The original use case that prompted the creation of this patch was using a Popup from Controls 2 to create a keyboard shortcut editor. When the user wanted to cancel the shortcut that they were editing, they could press escape, but Popup would grab the shortcut and close itself. As the test case demonstrates, the same problem occurs with the Shortcut type in Qt Quick. [ChangeLog][QtQuick][Keys] Added shortcutOverride signal to Keys attached object to allow prevention of e.g. Shortcut from stealing key events. Task-number: QTBUG-57098 Change-Id: I594e4ea17ec417d8c7d93c6cf347c1a1a2e62b93 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
| * | Merge remote-tracking branch 'origin/5.8' into devLiang Qi2016-12-141-34/+34
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp src/plugins/qmltooling/qmldbg_inspector/globalinspector.cpp src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.cpp src/qml/qml/qqmlimport.cpp src/quick/items/context2d/qquickcontext2dtexture_p.h tools/qmleasing/splineeditor.h Change-Id: I8f6630fcac243824350986c8e9f4bd6483bf20b5
| | * Get rid of most QT_NO_FOO usagesLars Knoll2016-11-291-34/+34
| | | | | | | | | | | | | | | | | | | | | | | | Instead use QT_CONFIG(foo). This change actually detected a few mis-spelled macros and invalid usages. Change-Id: I06ac327098dd1a458e6bc379d637b8e2dac52f85 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * | Merge remote-tracking branch 'origin/5.8' into devLiang Qi2016-11-231-74/+94
| |\| | | | | | | | | | | | | | | | | | | Conflicts: src/qml/jsruntime/qv4object_p.h Change-Id: Iff4d3aba7710a999b8befdc493cbe959e1ce02f9
| | * Quick: Do not calculate the difference in a geometryChangeErik Verbruggen2016-11-101-9/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This difference is only used by the ListView, so calculating it and storing it (on the stack) introduces a penalty for all items. As the new geometry is already applied, the old geometry is passed along. This has the added advantage that the ListView does not have to re-calculate that either. This fixes a performance regression. Change-Id: Id5e67bb663a5b11a55ec15ff24ca5b213d1fcef5 Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
| | * Quick: Hint that a reparent action will most probably work fineErik Verbruggen2016-11-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | When assigning an item a new parent item, a check is done if it is already part of the children tree below that parent. This is an unlikely case, so hint the compiler that it can optimize the loop that way. Change-Id: Ic9f1810aa4b83d84be88f0049e61d21c4add7767 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| | * Quick: Only take a copy of changeListeners when there are someErik Verbruggen2016-11-081-64/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the case where there are no change listeners, there is no need to do an ref() operation (which involves atomic loads) only to find out that it's an empty vector (!isSharable). Better still: the whole loop start-up can be skipped. Change-Id: I94fd22029a321a5dbef571145007071a54f5b04b Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Merge branch remote-tracking branch 'origin/dev' into wip/pointerhandlerShawn Rutledge2016-11-171-25/+144
|\| | | | | | | | | | | | | | | | | We no longer have any hope of getting this into 5.8. Change-Id: I2decfa47e589ba7ae2d6b951c6517a2c311d0192
| * | Merge remote-tracking branch 'origin/5.8' into devJ-P Nurmi2016-11-031-2/+2
| |\| | | | | | | | | | | | | | | | | | | Conflicts: tools/qmljs/qmljs.cpp Change-Id: Ifa9e74bdb780eaff22fbc9ba1c514d0078a3fb29
| | * Quick: allow NaN check to be inlinedErik Verbruggen2016-11-021-2/+2
| | | | | | | | | | | | | | | Change-Id: Ia4a935e1da82106954b661264e7a630befd80cc6 Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
| * | Merge remote-tracking branch 'origin/5.8' into devLiang Qi2016-10-221-10/+80
| |\| | | | | | | | | | Change-Id: I171c7dbb6a74fe743c2eec63e86e9c0bef7c7dfd
| | * Merge remote-tracking branch 'origin/5.7' into 5.8Liang Qi2016-10-201-10/+80
| | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/quick/items/qquickitemsmodule.cpp tests/auto/quick/rendernode/tst_rendernode.cpp Change-Id: I90582df69feb95a4e4aafb0b9793c23714654f19
| | | * QQuickItem: eliminate repeated access to QQmlV4Function::v4engine()J-P Nurmi2016-10-131-10/+10
| | | | | | | | | | | | | | | | | | | | Change-Id: Ifc33c17d125ca794a157a87dc5cc1be51c2aaefb Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| | | * Item: sort out mapFromGlobal() and mapToGlobal()J-P Nurmi2016-10-131-0/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The commit message of 08327da, and the change log of Qt 5.7.0 promised that mapFromGlobal() and mapToGlobal() were available in QML. But since the revision 7 of QQuickItem was not registered, this was not entirely true. Due to a little quirk in the QML engine's handling of revisioned methods, mapFromGlobal() and mapToGlobal() were only accessible via an identifier or property, but not directly: // works MouseArea { id: ma; onClicked: console.log(ma.mapToGlobal(Qt.point(mouse.x, mouse.y))) } // ReferenceError: mapToGlobal is not defined MouseArea { onClicked: console.log(mapToGlobal(Qt.point(mouse.x, mouse.y))) } Furhermore, this is inconsistent with how mapFromItem() and mapToItem() are exposed to QML. Even though the C++ versions of these methods take QPointF and QRectF, the QML versions take 2-4 number specifying x, y, width and height: object mapFromItem(Item item, real x, real y) object mapFromItem(Item item, real x, real y, real width, real height) object mapToItem(Item item, real x, real y) object mapToItem(Item item, real x, real y, real width, real height) Therefore the signature of mapFromGlobal() and mapToGlobal() should be: object mapFromGlobal(real x, real y) object mapToGlobal(real x, real y) This change implements the QML versions of these methods using QQmlV4Function, and adds the missing documentation for the QML API. NOTE: This is QML-only API. Change-Id: I2ced4836d274c7d1e644ea29fc25dbdd2045001b Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * | | Merge remote-tracking branch 'origin/5.8' into devLiang Qi2016-10-181-10/+59
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/jsruntime/qv4variantobject.cpp src/qml/types/qquickworkerscript.cpp src/quick/scenegraph/util/qsgdefaultpainternode_p.h tools/qmljs/qmljs.cpp Change-Id: I876242714ec8c046238d8fd673a5ace2455b2b59
| | * | Merge "Merge remote-tracking branch 'origin/5.7' into 5.8" into refs/staging/5.8Liang Qi2016-10-101-9/+31
| | |\ \