aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items
Commit message (Collapse)AuthorAgeFilesLines
* Improve Context2D's line dash-related documentationMitch Curtis2019-05-031-5/+7
| | | | | | | Fix spelling errors, punctuation, and links. Change-Id: I79154d0da6acf403903f102655d5dcb64240b137 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QQuickTextControl: Emit cursorPositionChanged() when handling IM eventVova Mshanetskiy2019-05-021-0/+3
| | | | | | | | | | | | | | | | QQuickTextControl and consequently QQuickTextEdit did not emit cursorPositionChanged() signal when cursor position was changed by a QInputMethodEvent with a QInputMethodEvent::Selection attribute. This is especially important on Android because QAndroidInputContext uses such events extensively to move the cursor and also relies on cursorPositionChanged() signal being emitted by the focus object. If the signal is not emitted, QAndroidInputContext does not notify the virtual keyboard about cursor position change which results in various glitches. Change-Id: I46bef6185463d11507b1b96435fdc056bbe951f2 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Fix memory leak with QQuickEventPointJeremy Powell2019-04-241-22/+16
| | | | | | | | | | | Store PointVelocityData by value in the QMap to avoid leaking memory. This also appears to be slightly faster than heap allocation, with the struct being relatively small (24 or 32 bytes depending on qreal). Fixes: QTBUG-73182 Change-Id: Ibd9374746b76fd5b78c23283d278b6af42907c96 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Debug missing synth-mouse ID in hex, not decimalShawn Rutledge2019-04-171-1/+1
| | | | | | | | It's hard to correlate with the other debug messages otherwise. Task-number: QTBUG-74008 Change-Id: I611201cc8ca86739251b72ccc3e1c5860cfdad8a Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Quick fix for not working input handling for eglfsMichal Klocek2019-04-151-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On eglfs platform input events are driven by libinput and do not have window information as such. They are simply delivered based on QGuiApplication::topLevelAt window selection. In case of WebEnigne, QQuickWindow is returned as top level window. QQuickWidget uses this QQuickWindow as an offscreen window, however since 561b932 we fake 'visible' and 'visibility' values so windows api in qml can use those properties. This ends up with broken event delivery on eglfs, since window is offscreen and therefore not really visible. Make a minimalistic change to fix the issue, without braking QTBUG-49054, which requires 'visibility' to have fake values, and 'visible' will keep window as not visible for event delivery system. Fix encapsulation of setVisible(), prevent accidental window creation when setVsiible() called from qml via binding. The proper fix would require for example adding some new flag to underlying offscreen window, which could be used by event window selection mechanism or rework of qquickwidget offscreen window parameters expose to qml. Task-number: QTBUG-65761 Task-number: QTBUG-49054 Change-Id: I2a307ee5613771adf6d31f1c3cc4b4a25d7620df Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QQuickWindow: Run render jobs when there is a render control in NoStageAndy Shaw2019-04-091-2/+10
| | | | | | | | | | | When running a QML application with using Canvas3D component inside a QQuickWidget, the Canvas3D is not rendered. This is due to no scheduled OpenGL commands with RenderStage == NoStage are actually executed when there is a render control instead of a window manager. Fixes: QTBUG-51993 Change-Id: I33323893cd6144187feccb1c6bcd010eff0fff6d Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* In response to touch cancel, don't just ungrab, send an ungrab eventShawn Rutledge2019-04-041-2/+2
| | | | | | | | | | | | | | | | | | QQuickWindowPrivate::sendUngrabEvent() sends an UngrabMouse event, and that can be filtered by parent filters. If a touch cancel happens to a MouseArea in a ListView delegate, we need the ListView to filter the UngrabMouse event so that QQuickFlickable::childMouseEventFilter() will call QQuickFlickable::mouseUngrabEvent() and QQuickFlickablePrivate::cancelInteraction() will set pressed to false. The pressed state became true because Flickable filtered the press event; so for symmetry, it also needs to filter the touch cancel (in the form of a mouse ungrab), to avoid being stuck in a state where it can't move programmatically. Fixes: QTBUG-74679 Change-Id: I6c0ed364d2bc1f45c7e7b17846a09f6b53f91d0a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Fix incorrect PathView.currentIndex assignment with StrictlyEnforceRangeShawn Rutledge2019-03-271-4/+0
| | | | | | | | | If currentIndex is quickly assigned a different index and then the previous current index again, it should not move. Fixes: QTBUG-74508 Change-Id: I8d610e3fe452c8631e082c648e77d2cb70ae57c5 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Restore rich Text creation speedShawn Rutledge2019-03-261-1/+1
| | | | | | | | | | | | | | | | 634b59f187c8697f03a606cbacb5f0a69650ea7c caused a significant performance regression during layout of any Text item with RichText, by calling QQuickTextDocumentWithImageResources::setPageSize() with an accurate width in ensureDoc(); but ensureDoc() is called multiple times, and doesn't need to calculate actual layout. The accurate width is needed (at least) when doing layout of HTML tables that contain percentage-based column widths. For that purpose it's enough to set the correct "page" size in updateSize(). Fixes: QTBUG-74638 Task-number: QTBUG-72457 Change-Id: I34ab085316018576eba64a67200c527bb64b9533 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix leaking of QML QQuickItemGrabResult objectsVal Doroshchuk2019-03-111-2/+4
| | | | | | | | | | | | If QQuickItem::grabToImage is called from QML, QQuickItemGrabResult is created but was never deleted. Adding a deleteLater() right after dispatching the callback ensures that QQuickItemGrabResult objects are deleted. Task-number: QTBUG-73723 Change-Id: Ifda85599098f2b679ae5f22e1d47a73962ed0a85 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Fix a bug where hover events were not sent if the mouse was never movedJan Arve Sæther2019-03-041-0/+1
| | | | | | | | | | | | | This happened if the "real mouse" was never moved, since moving the real mouse caused it to update the internal QQuickWindowPrivate::lastMousePosition. If the window never got any mouse events, it would therefore fail to generate proper hover events. However, if the window got exposed under a mouse cursor it would generate a hover enter event. We therefore update lastMousePosition when that happens also. Change-Id: I77d9b1bd779a813756c4056b015f2e81664b6d36 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Don't crash if the synth-mouse touchpoint is absent from a touch eventShawn Rutledge2019-03-041-12/+16
| | | | | | Fixes: QTBUG-74008 Change-Id: Ib232b723e4a246db0312145ef475ce81cd5f1a5f Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* QQuickFlickable: fix setContentX/setContentY comparing qrealYulong Bai2019-03-011-2/+2
| | | | | | | | | QQuickFlickable::setContentX/setContentY used !=/== to compare qreal, which would trigger binding loop warnings while using bi-directional property bindings. Fixes: QTBUG-74128 Change-Id: I224a924e11c93cf047478ba0e09e10e57eedabde Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Text: render table cell backgrounds properlyShawn Rutledge2019-02-282-9/+13
| | | | | | | | | | | | | | | | | | | QQuickTextNodeEngine::addTextBlock() was noticing the background color of text fragments, including those within table cells (and adding to the colorChanges vector for rendering), but not rendering a rectangle for the background of the entire table cell. So while the color was correct, it only took up as much space as the text itself. Also, QTextDocumentLayout needs to be told how much width is available so that QTextDocumentLayoutPrivate::layoutTable() will allocate cell width appropriately in case width is given as a percentage, e.g. <td width="20%">. This is done by calling QTextDocument::setPageSize() with correct width in pixels rather than zero. Fixes: QTBUG-72457 Change-Id: I5c8f861829f76d1cf4044fccd1142c3817bb33bc Reviewed-by: Andy Shaw <andy.shaw@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Doc: Fix link issuesNico Vertriest2019-02-281-7/+8
| | | | | Change-Id: I0e08820a6d25996fe27118f05214ff63d695d24e Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
* Don't crash when passive grabber deleted before exclusive gr. releasedShawn Rutledge2019-02-261-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | In this scenario, a DragHandler is inside an Item in a Loader, under a MouseArea, which unloads the loader on press. So on press, the DragHandler acquires a passive grab, then the MouseArea acquires the exclusive grab, then the DragHandler is destroyed along with its parent when the Loader is unloaded. On release, QQuickEventPoint::setGrabberItem(nullptr) was sending an onGrabChanged(passiveGrabber, OverrideGrabPassive, this) notification. That was questionable: the handler was not just then getting its grab overridden, but rather un-overridden, because the exclusive grab was being released. It's also a good idea to check for null pointers, since m_passiveGrabbers is a collection of QPointers already, so we can tell when a passive grabber is deleted dynamically. It can also be reproduced with MultiPointTouchArea just as with MouseArea, so the test is written that way for convenience, because we have tst_multipointtoucharea_interop already. It doesn't really matter which handler has the passive grab, or which item has the exclusive grab that's being relinquished. Fixes: QTBUG-73819 Change-Id: Ic605efa2143a1d849be095dcb88d6c38d7d2ee19 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Update the cursor when the window is enteredAndy Shaw2019-02-251-0/+1
| | | | | | | | | | | | When a window is entered, due to another window being hidden, then it is possible that the item under the mouse has a different cursor than the one previously set for that window. Since there will not be a mouse move at this point yet, then we should update the cursor right away. Change-Id: I2ef3c72617ae5c995a4daf7daef1ba3311fdcc12 Fixes: QTBUG-41045 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QQmlDelegateModel: guard new row/column properties with revision 12Richard Moe Gustavsen2019-02-212-0/+13
| | | | | | | | | | Tag the new 'row' and 'column' properties with revision 12. This will make sure that they cannot be accessed by the delegate unless the QQmlAdaptorModel has the correct minorVersion set. Fixes: QTBUG-70031 Change-Id: I49e67c37ab5b7925c7bca313bbb99f04d1387cc4 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QQuickTableView: use correct WRITE function for contentHeightRichard Moe Gustavsen2019-02-181-1/+1
| | | | | | | | | | The auto test didn't catch this, since there we use the setter functions directly from c++, instead of accessing the properties. Change-Id: I2101e4cfab11d1c0e037f6ca134b6804d328e162 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Canvas: Handle switching between object and string based colorsAndy Shaw2019-02-141-2/+7
| | | | | | | | | | | | | When switching between the two it should respect whatever the color is regardless of whether it is a color value or a string based color. This also accounts for "invalid" colors as this should set the stroke-style to be #000000 to be inline with the default stroke-style indicated in the specification. Change-Id: I00bee6c9a85787762271882838510b4187798ee0 Fixes: QTBUG-42155 Fixes: QTBUG-52959 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Doc: explain when the move velocity and duration properties are usedMitch Curtis2019-02-071-0/+5
| | | | | Change-Id: Iaf7cf035f76a1f198c60f4792d394b0fd19ef901 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QQuickWindow: don't give exclusive grab to invisible or disabled ItemsShawn Rutledge2019-02-051-1/+1
| | | | | | | | | | | | An Item might set itself invisible or disabled while handling a mouse press, as an alternative to rejecting the event. In earlier Qt versions (e.g. 5.6) it did not end up with a grab in such a case. Task-number: QTBUG-63271 Change-Id: I12f646e4217d773d396f380672420c85e6adcd52 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* TapHander: do not "want" an eventPoint that is outside parent boundsShawn Rutledge2019-01-301-1/+1
| | | | | | | | | | | | | | | | | So far it was checking parentContains() on press, release, or when the gesturePolicy is WithinBounds, but not for each movement when the policy is DragThreshold (the default). This might explain most of the remaining warning noise: "pointId is missing from current event, but was neither canceled nor released" because it was possible for TapHandler to remember wanting a point that it should not have wanted, but without taking any kind of grab, and then complaining when that point was no longer present. Since it did not grab, it did not get the release, unless the release was part of an event containing a point that it DID grab. Fixes: QTBUG-71887 Change-Id: I26ce62279574cf6b0150f24e486f224a604ac6b1 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* TextInput: Stop leaking password values to process memoryIvan Čukić2019-01-292-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The contents of a deleted QString can still remain in memory and can be accessible by tools that read the raw process memory. The same problem appears when the QString reallocates -- the old buffer gets deleted, but its contents will remain in memory. This means that a TextInput that serves as a password input field can leak parts of the password while the user is entering it (due to reallocation) and the whole password when the TextInput instance is destroyed. With this patch, the contents of the m_text string member variable will be zeroed-out before the TextInput is destructed. This is done only in the cases when the TextInput serves as a password field. Also, this patch reserves the space for 30 characters for m_text when the TextInput is used for password input. This is enough to make sure no reallocation happens in majority of cases as barely anyone uses passwords longer than 30 characters. [ChangeLog][QtQuick][TextInput/security] When the TextInput is used for password input, preallocate a buffer for the string that stores the entered value and zero-out the string on TextInput destruction to avoid leaking sensitive data to process memory Change-Id: I8f1f307b1cfc25ad51f48bae8509a258042a2e7f Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* Canvas: Guard context pointer against external deletionUlf Hermann2019-01-231-144/+166
| | | | | | | | | You cannot keep the context when reparenting the canvas item. Use a QPointer prevent dangling. Task-number: QTBUG-73113 Change-Id: Ie7021c6f0bb0d09923eb358dc7e51d6727e74a7a Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add handlers declared as Flickable children to its contentItemShawn Rutledge2019-01-224-4/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | QQuickItemPrivate::data_append() was not invoked when any kind of Pointer Handler was directly declared in a Flickable (or subclass) because QQuickFlickable redefines the default property to be its own flickableData property. So we need to repeat the special handling in QQuickFlickablePrivate::data_append() too. The handler must be added to the private->extra->pointerHandlers vector, so that QQuickItemPrivate::handlePointerEvent() will attempt to deliver events to those handlers. TapHandler seems OK (especially with its default gesturePolicy so that it does not do an exclusive grab). PointHandler seems OK. DragHandler competes with Flickable for the exclusive grab. pressDelay can help; or set acceptedDevices: PointerDevice.Mouse to allow the mouse to drag but not flick, and the touchscreen to flick but not drag. Fixes: QTBUG-71918 Fixes: QTBUG-73035 Change-Id: Icb97ed5230abe0cb6ec0230b5b5759a0528df7e8 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Merge "Merge remote-tracking branch 'origin/5.12.1' into 5.12" into ↵Liang Qi2019-01-221-1/+1
|\ | | | | | | refs/staging/5.12
| * Merge 5.12 into 5.12.1Kari Oikarinen2019-01-083-5/+19
| |\ | | | | | | | | | Change-Id: Ic746fbce93430867e2eda4bc7155d34e20a4aa2b
| * | Fix regression in border-top with high-dpiAllan Sandfeld Jensen2019-01-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Device pixel ratio was included twice. Task-number: QTBUG-72603 Change-Id: Idd1b75c3b1926a6381bf258c1b705be10c5575b9 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* | | Documentation: Start using the \nullptr macroFriedemann Kleint2019-01-211-3/+3
| |/ |/| | | | | | | | | Task-number: PYSIDE-903 Change-Id: I0c4640eb20157673eabb131e8834e79cbbf95d5c Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* | Doc: velocity properties must be set to -1 when setting durationMitch Curtis2018-12-131-1/+12
| | | | | | | | | | | | | | | | | | This is an important detail that was left out, causing confusion when a user tries to set e.g. highlightMoveDuration without setting highlightMoveVelocity to -1. Change-Id: Ida4042626fcc20105267a5d2a0babcb91eed1516 Reviewed-by: Michael Brasser <michael.brasser@live.com>
* | Fix missing strike outDaniel Engelke2018-12-101-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added <s></s> and <del></del> tag aka strike out to QQuickStyledText. QQuickStyledText covers the essential text decorations, apart from strike out. In order to use it, one had to switch to RichText, which comes with its own overhead and limitations. <s> for no longer accurate or no longer relevant content <del> for removed content Fixes: QTBUG-72376 Change-Id: I3c191d91d57afcc48090facc49d643f8ad708fb4 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | TapHandler: ignore scroll events and native gesturesShawn Rutledge2018-12-101-4/+5
|/ | | | | | | | | | | | | | During a 2-finger press (to emulate right click on a trackpad), the OS may also generate a QWheelEvent with ScrollBegin phase just in case scrolling starts. This must not prematurely deactivate the TapHandler. Also if a gesture or wheel event begins as the very first event after an application starts, ensure that subsequent mouse events are not mis-delivered as wheel or gesture events. Fixes: QTBUG-71955 Change-Id: Ic12e116483ab9ad37c4ac3b1d10ccb62e1349e0a Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Ensure that each Event Handler has an Item parent rather than assertingShawn Rutledge2018-12-071-1/+5
| | | | | | | | | | QQuickItemPrivate::data_append() was already getting called, but the assert (that the parent was already an Item) was failing in case a handler was declared inside a Window or a Dialog. Fixes: QTBUG-71317 Change-Id: Ia497182e3b4a9722eee97a375f9ee5d4151108e6 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Add dynamically-created Event Handlers to the relevant handlers vectorShawn Rutledge2018-12-073-12/+22
| | | | | | | | | | | | | | | | | If any kind of Pointer Handler is created dynamically in JS by calling Component.createObject(), QObject::setParent() is called rather than passing the parent to the constructor, so QQuickItemPrivate::data_append() did not take care of adding the handler to QQuickItemPrivate's extra->pointerHandlers vector. We need to use the auto-parent mechanism (just as we did with handling dynamic creation of nested Windows in 8cb02e23abbefc9d020707fc1a2d8b6eb4e103b6). Added QQuickItemPrivate::addPointerHandler() to put the prepend() and implied setAcceptedMouseButtons() in one place. Fixes: QTBUG-71427 Change-Id: I3be3dd033c1c89e6e5b5c3463e1a720bbe963281 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Declare the enum so it can be passed to the QML sideAndy Shaw2018-11-301-0/+1
| | | | | | | | | In order for the enum value to be passed to the QML side then it needs to be registered so it can be picked up. This fixes the signals using QQuickEventPoint::GrabTransition, such as PointerHandler's grabChanged. Change-Id: I387930d50f03fee867b3d869618525d44173b538 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Prevent overly drawn-out animation when snappingMichael Brasser2018-11-291-1/+5
| | | | | | | | Don't trigger (potentially seconds long) animation to to fix very small errors in offset. Change-Id: Ibdba16e4fb7a1aff7577a29ab594af8aba231d6d Reviewed-by: Martin Jones <martin.jones@qinetic.com.au>
* QQuickTableView: connect directly to the model, and not to the QPointerRichard Moe Gustavsen2018-11-281-4/+6
| | | | | | | | Fixes building with gcc 4.8.4 Change-Id: I61810102bba20c21321112c63e7197bbe05ec27d Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Fix vertical alignment of images in a text documentLars Knoll2018-11-224-13/+20
| | | | | | | | | | | The vertical alignment was not calculated correctly in all cases, this should fix it by retrieving the height and baseline for the current text line and doing the calculation correctly in all cases. Change-Id: I5bb650ede46dc03d51bf0f64b77dc4ca77d30fd2 Fixes: QTBUG-59310 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> Reviewed-by: Igor Bugaev <freedbrt@gmail.com>
* Fix updating of text nodes in QQuickTextEditLars Knoll2018-11-221-1/+12
| | | | | | | | | | | The update algorithm wasn't working correctly if there were two disconnected dirty regions in the textNodeMap. This could happend by e.g. programatically removing text at the beginning and appending at the end. Change-Id: I3de2c8efedb03c004c4c304d130360cbdb4485b7 Fixes: QTBUG-68863 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* QQuickText: Signal content height/width changes also when resettingUlf Hermann2018-11-202-9/+18
| | | | | | | | | If we change the content height or content width to the initial one, we still need to signal the change. Fixes: QTBUG-71684 Change-Id: Idf6e3f89423eab3d8f5310c164c5acc5108e0d8b Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* Fix null pointer access in QQuickOpenGLShaderEffectMaterialCacheJüri Valdmann2018-11-072-1/+3
| | | | | | | | | | | If a QQuickWindow is destroyed without ever being rendered, then there won't be any QOpenGLContext in QQuickOpenGLShaderEffectMaterial::cleanupMaterialCache. Same goes for QQuickWidgetRenderControl. Fixes: QTBUG-65236 Change-Id: I2742505d147bc8444b46688170d33fbb2844f2ac Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Doc: Remove wrong return typeJoni Poikelin2018-11-021-1/+1
| | | | | Change-Id: Iebd325afcfc0e892f970d450b59e0249d1fcb83f Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* QQWindow: cancel touch->mouse synthesis when touch is ungrabbedShawn Rutledge2018-10-302-22/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, each time a new touchpoint is pressed, we would purposely forget which touchpoint was acting as the mouse, as part of "starting over" with event delivery. Conceptually "starting over" ought to mean as freshly as possible; but in practice, if a user was using one finger to interact with some mouse-only Item, and then presses a second finger (whether intentionally or not), (s)he doesn't want the first interaction to immediately end. The multi-finger DragHandler must be able to take over the grab from the Item which already had the grab; but it uses a passive grab in the meantime to track the movement, and normally takes over the exclusive grab only when its preconditions are met: the point has to move past the drag threshold. So we can wait until then to reset the touchMouseId. The concrete use cases are: double-tapping a map is supposed to zoom in, even if there is a MouseArea on top. And, while dragging a Slider inside a Flickable, you should be able to start dragging the Flickable with a second finger. In the first case the issue was that the MouseArea could grab while handling the synth-event, thus setting touchMouseId; then touchMouseId was immediately reset again while handling the second touchpoint, so the second touchpoint would also be offered as a synth-mouse event to various items. But while fixing that, we have to avoid this issue in the Slider-in-Flickable case: when the first touch press is delivered, Flickable takes the exclusive grab temporarily; after moving the touchpoint, the Slider's DragHandler steals the exclusive grab. Then we try to deliver the second touchpoint press: at this time, we don't want touchMouseId to be set, because we want to be able to deliver synth-mouse events for the second point so that Flickable can grab that one. So it must be that when DragHandler steals the grab, we can reset touchMouseId, because the only reason it was set was that Flickable had the grab. This result is achieved by having QQuickItem::touchUngrabEvent() call a new QQuickWindowPrivate::cancelTouchMouseSynthesis() function. It was already a good idea to have such a function since we always reset touchMouseId and touchMouseDevice at the same time. Also modify the docs to remind users that when subclassing QQuickItem and overriding mouseUngrabEvent() or touchUngrabEvent() they should call the base class implementation, to avoid bypassing this new functionality. Fixes: QTBUG-70998 Change-Id: I02894971e9047d4fa7ac9d062d6714c9183a8058 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Merge remote-tracking branch 'origin/5.11' into 5.12.0Liang Qi2018-10-302-0/+10
|\ | | | | | | | | | | | | | | | | Conflicts: src/imports/settings/qqmlsettings.cpp src/quick/items/qquickwindow.cpp tools/qmlplugindump/main.cpp Change-Id: I3e5dae4de25b2da961a572b3a4bd151181d211c9
| * Warn, don't crash during nested delivery of mouse or touch pressesShawn Rutledge2018-10-132-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | If during delivery of a mouse press, user code calls qApp->sendEvent() with another mouse press, then when delivery of the nested event is finished, we call QQuickPointerMouseEvent::reset(nullptr). Then when delivery of the original mouse press resumes, crashes are possible because most of the code assumes that QQuickPointerEvent::m_event is not null during delivery. Change-Id: Id65b1f2f64351e40d03bcd4f4d16693d616729da Fixes: QTBUG-70898 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | Fix backward QML compatibility for Flickable.isAtBoundaryChanged()Alexander Akulich2018-10-251-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QML code that imports any previous QtQuick version (e.g. 2.11) and connects to any of the four 'at boundary' properties (atXEnd, atXBeginning, atYEnd and atYBeginning) change notifier (e.g. atXEndChanged) stop working because the new signals available only with new import, but the older import has no idea that it could connect to the older notifier (isAtBoundaryChanged). Remove revision number from the notifiers of the four 'at boundary' properties to mostly fix backward compatibility until a better solution is available. Fixes: QTBUG-71243 Change-Id: I9b4c944c62e0c6c83ceed765b7cd99519e9cd109 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* | Fix QML compatibility for Text.contentWidth/Height changed handlersAlexander Akulich2018-10-251-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The properties used to have a single notifier that name is different from the properties names. QML Engine always connects a handler to signal, if it exists and only if there is no such signal then it lookup for a property notifier. In commit e92f76cf9ea91e87ec2e3e68234899fd9c12142f we introduced new signals that match the names of the two property changes handlers, but the signals are not available on older import. Remove revision number from the notifiers of Text.contentWidth/contentHeight to fix backward compatibility until a better solution (such as extra engine logic like "if a signal that matches the handler is not available then check if there is a way to connect to a property notifier that matches the handler" Fixes: QTBUG-71247 Change-Id: I11fb6230d85218ef437816c60c8147b953d47241 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Item Views: cancel flicking before a model resetTobias Koenig2018-10-191-0/+1
| | | | | | | | | | | | | | | | | | | | | | While the view is flicking, if the content is updated by a model reset, it gets very confused and creates many delegates that won't be shown inside the visible area. Now we cancel any active flicking before the model reset is handled. Fixes: QTBUG-70742 Change-Id: I6f7aa368b760a00d08c540f3963c32e1e174a908 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | Optimize QQuickWindowPrivate::grabTouchPoints()Shawn Rutledge2018-10-181-7/+19
| | | | | | | | | | | | | | | | | | It's given a list of touchpoint IDs, which normally are from the same event, so we should not need to find the corresponding device and its event repeatedly. Change-Id: I65ce120c50251d23b1300b79b9372e8e54e53741 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>