aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2/qquickdial.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix compile warnings: replace QTouchEvent::touchPoints with pointsVolker Hilsheimer2020-10-021-1/+1
| | | | | | | | | QTouchEvent::touchPoints() is deprecated in qtbase as of 2692237bb1b0c0f50b7cc5d920eb8ab065063d47, and replaced with QPointerEvent::points(). Change-Id: Ibe5722cf12526f47436921dcef8d3ed7e73cf4cd Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Add setAcceptTouchEvents() in more controls that handle touch eventsShawn Rutledge2020-10-011-0/+3
| | | | | | Task-number: QTBUG-87018 Change-Id: I5f9318bd1cad0f760caf02b9066e729af3601098 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Fix event refactoring warnings and errorsMitch Curtis2020-08-111-5/+5
| | | | | Change-Id: I426b4f75066c9db72759398e4d76fd5323044d57 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2019-11-301-1/+1
|\ | | | | | | Change-Id: Icb923b10d2b6c524ebaa8b38c7979b780e3582d4
| * Doc: Fix qdoc warningsVenugopal Shivashankar2019-11-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | The warnings were about: - Undocumented function parameters - Instances of \instantiates that us an internal class - A few link issues Task-number: QTBUG-79827 Change-Id: I60094279c7da6bc446b5c63b7b4924b71cee4672 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* | Don't delete items we didn't createMitch Curtis2019-11-281-1/+1
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Up until this patch, we've always deleted "old" items when a new one is assigned. For example, the style's implementation of contentItem will be destroyed here as it is not accessible by the user and is no longer used: Button { contentItem: Item { /* ... */ } } This was especially important before the introduction of deferred execution, as the "default" items would always be created, regardless of whether the user had overridden it with one of their own items. By deleting the old items, we free unused resources that would otherwise persist until application shutdown (calling gc() does not result in the items being garbage-collected, from my testing). Although this has largely worked without issues, deleting objects that weren't created by us in C++ is not supported. User-assigned items can be created in QML (with JavaScriptOwnership) or C++ (with CppOwnership), and it is up to the user and/or the QML engine to manage the lifetime of these items. After the introduction of deferred execution, it became possible to skip creation of the default items altogether, meaning that there was nothing to delete when assigning a new, user-specified item. This requires that no ids are used in these items, as doing so prevents deferred execution. Assuming that users avoid using ids in their items, there should be no unused items that live unnecessarily until application shutdown. The remaining cases where items do not get destroyed when they should result from the following: - Imperative assignments (e.g. assigning an item to a Button's contentItem in Component.onCompleted). We already encourage declarative bindings rather than imperative assignments. - Using ids in items. Given that these are use cases that we will advise against in the documentation, it's an acceptable compromise. [ChangeLog][Important Behavior Changes] Old delegate items (background, contentItem, etc.) are no longer destroyed, as they are technically owned by user code. Instead, they are hidden, unparented from the control (QQuickItem parent, not QObject), and Accessible.ignored is set to true. This prevents them from being unintentionally visible and interfering with the accessibility tree when a new delegate item is set. Change-Id: I56c39a73dfee989dbe8f8b8bb33aaa187750fdb7 Task-number: QTBUG-72085 Fixes: QTBUG-70144 Fixes: QTBUG-75605 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Fix compilation with qreal=floatFriedemann Kleint2018-11-261-3/+3
| | | | | | | | Introduce casts where required. Fixes: QTBUG-71952 Change-Id: I63a99d6918bc00367439e967e3c45a733b41c482 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Dial: add inputMode propertyMitch Curtis2018-05-151-2/+74
| | | | | | | | | | | | | | | | | | This property adds two new ways of interacting with the dial: horizontally and vertically. These new input modes use a relative input system, which means that, unlike the old absolute input system, changes to the dial's position are "added" to its value. This results in a dial that is less "jumpy", making it safe for operations that could be harmful if done incorrectly, like adjusting audio levels. [ChangeLog][Controls][Dial] Added the inputMode property. This property controls how the dial is interacted with. The circular input mode (default, old behavior) operates on an absolute input system, whereas the horizontal and vertical input modes use a relative input system. Task-number: QTBUG-56323 Change-Id: Iab4e7f048b4797ab626741326ce709914e67bd31 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* Templates: use C++11 default member initializationJ-P Nurmi2018-05-041-25/+10
| | | | | | | | | | | The code is more readable and less error-prone (this patch caught a few uninitialized members) when the members are initialized in the same place where they are declared. In many cases, empty default destructors can be entirely removed, and we get faster implicitly declared inline default constructors defined by the compiler. Change-Id: I14c5448afc901f9b2ac5965f28c1c26c0b646c08 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Sliders and Dials: keep mouse grab on pressJ-P Nurmi2018-03-121-15/+1
| | | | | | | | | | | Since Qt 5.9, Sliders and Dials react immediately on mouse press. Thus, the old logic to keep mouse grab if the drag threshold was exceeded no longer makes sense with mouse. Don't allow e.g. Drawer to steal mouse press if a Slider or Dial is already being dragged. Task-number: QTBUG-66637 Change-Id: I76f7ab59180c1f3fb66db8412d7cccfbd373aee3 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Fix deferred executionJ-P Nurmi2017-12-211-1/+11
| | | | | | | | | | | | | | | | | | If the QML engine refuses to defer execution of a delegate (it contains an ID), we must make sure to cancel any pending deferred execution for the same delegate. Otherwise, we may end up overriding a custom (non- deferred) delegate with a default (deferred) delegate. This patch adds a new test style "identified" to tst_customization. This style contains delegates with IDs so we can test the behavior with IDs in base styles. Furthermore, overriding delegates is now tested in various ways (with and without IDs in the base and custom styles) in a separate test method. This is done by generating QML code to override delegates with dummy Item instances with appropriate IDs and names. Task-number: QTBUG-65341 Change-Id: Ie6dca287cb74672004d9d8f599760b9d32c3a380 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Control: defer the execution of the background itemJ-P Nurmi2017-12-151-1/+0
| | | | | | Task-number: QTBUG-50992 Change-Id: I6372e143c68f0a5bf7212d759281acef3c81618e Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Dial: use deferred executionJ-P Nurmi2017-12-131-4/+26
| | | | | | Task-number: QTBUG-50992 Change-Id: I432be00d81344ce129bc8906370555b134fdf423 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Re-order all revisioned members and add explanatory commentsJ-P Nurmi2017-11-061-28/+28
| | | | | | | | | | We've come to realize that even though it's tempting to group similar properties together, organizing the API so that revisions are grouped together makes future maintenance more pleasant. It's a lot easier to to see what was added and when. Change-Id: I47ba7725260f2c259048848cc2a9b17bce2f01c7 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* Fully qualify atan2 with the std namespaceJake Petroules2017-09-081-1/+1
| | | | | | | | This fixes the build on VxWorks Change-Id: I5ba3d182184151b62e3ed6c0ab5e4d77a0e66768 Reviewed-by: Tuomas Heimonen <tuomas.heimonen@qt.io> Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
* Let users disable the multi-touch supportJ-P Nurmi2017-06-071-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | The newly added multi-touch support can create issues, especially together with Flickable that is unfortunately still not properly touch-compatible. The implementation is still based on synthesized mouse events, so things like Flickable::pressDelay that intercepts mouse presses and re-sends sends them after a delay, does not play well with touch-enabled controls. The easiest way we can disable the whole thing is to make multi- touch support a configurable feature, the same way hover support is. ./configure -no-feature-quicktemplates2-multitouch [...] Qt Quick Templates 2: Hover support .......................... yes Multi-touch support .................... no [ChangeLog][Templates] Added a configure feature for disabling multi- touch support (configure -no-feature-quicktemplates2-multitouch). Task-number: QTBUG-61144 Change-Id: I0003ae925c2a499ecb3e2a5b720088bd963d9ad3 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Doc: add the Qt version to "\since QtQuick.Controls 2.x"J-P Nurmi2017-05-301-2/+2
| | | | | Change-Id: Ia7f237cb580bf9c332ff4741569a57fef4eb6079 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Override QQuickControlPrivate::handleXxx()J-P Nurmi2017-04-201-62/+27
| | | | | | Change-Id: I5c5be24142a758637e18df24b43847a8c6079346 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QQuickControl: implement focus handling on touchJ-P Nurmi2017-04-201-6/+3
| | | | | | | | | | | | | | | | | | | | QQuickControl::focusPolicy was only managed in mousePressEvent() and mouseReleaseEvent(). All controls call the base class implementations of these event handlers to get the focus policy handling "for free". Move focus policy handling to handlePress() and handleRelease() that can be re-used for touch events, and make sure that various controls call the base class implementation of touch event handlers. There's still a bit of duplication in QQuickControl::touchEvent() and the overridden handlers in sub-classes, but this will be improved step by step. QQuickControlPrivate::handlePress/Move/Release/Ungrab() are planned to be made virtual, overridden in subclasses, and only called from QQuickControl event handlers. Most mouse and touch event handlers in QQuickControl subclasses can be removed later when we get there. Task-number: QTBUG-58389 Change-Id: I7e82dc2ef49762a005c482ce1353e03cc841659f Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Dial: react immediately when using a mouseJ-P Nurmi2017-04-051-3/+3
| | | | | | | | | | | | The initial drag threshold is a necessary evil on touch to avoid conflicting with flickables, but leads to bad experience (QTBUG-47081) when using a mouse. Now that we have separate mouse and touch handling, we can apply immediate moves when using a mouse, but keep the old behavior on touch. Task-number: QTBUG-59920 Change-Id: I097cbdaed4933c0d907097b75f15ba16dcf615b1 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Set explicit cursors on all interactive controlsJ-P Nurmi2017-04-051-0/+3
| | | | | | | | | | | | For example, if you have a floating button on top of a text editor, hovering the button must change the cursor from the editor's ibeam cursor to an arrow cursor. This applies to all interactive controls that call setAcceptedMouseButtons(). If a control blocks mouse events, it should not use some random cursor from another control underneath. Task-number: QTBUG-59629 Change-Id: I8a6ae306bbc76a9b22377361cb19cf9c3a872d31 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Doc: fix linking error in qquickdial.cppJ-P Nurmi2017-03-281-1/+1
| | | | | | | | | | | Dial::valueAt() does not exist. qquickdial.cpp:515: warning: Can't link to 'valueAt()' The broken see also link was accidentally copied from Slider. Change-Id: I781b7d0bcf15d3b34dd2b8784a273d5cd7218469 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Port from QT_NO_ACCESSIBILITY to QT_CONFIG(accessibility)J-P Nurmi2017-02-241-1/+1
| | | | | Change-Id: I03deebff661746d49e537af5b1c8899b938efb0d Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Cancel incubation of replaced/destroyed delegatesJ-P Nurmi2017-02-101-1/+1
| | | | | | | | Resolves the "Object destroyed during incubation" issues. Task-number: QTBUG-50992 Change-Id: Ie58c958dafbf915da7494dac25351be98106c6ea Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Fix build with -no-feature-wheeleventJ-P Nurmi2017-01-311-0/+2
| | | | | Change-Id: I6f40794ae1977d1f23916bff6d0c58d44440fbe5 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Default QQuickDial::live to trueJ-P Nurmi2017-01-271-13/+3
| | | | | | | | | [ChangeLog][Important Behavior Changes] On a popular demand, Dial has been changed to report live value updates. This can be disabled by setting Dial::live to false. Change-Id: Ie591ec33f56482b825250f64abf55118afec3e6b Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Use keepTouchGrab instead of keepMouseGrab when handling touch eventsJ-P Nurmi2017-01-241-5/+6
| | | | | Change-Id: I7ea3db90fbafea68c094d1525ee28972823960ac Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Re-format constructorsJ-P Nurmi2017-01-191-2/+2
| | | | | | | | | | | It was a bit inconsistent before. Admittedly the colon at the end was the most commonly used style in the quicktemplates2 code base, but some had a line-break before the colon. This is now chosen as the one true coding style of QQC2. ;) It makes the initializer list aligned so that it stands out from the constructor body. Change-Id: I66835e088df90d7219af04915176006d2a934ddc Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Format initializer listsJ-P Nurmi2017-01-191-13/+13
| | | | | | | | Initialize one member per line. Allow empty constructors with one initialized member on a single line. Change-Id: Ie115802561ebd19efd4dacda1fa868b64d279109 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Merge remote-tracking branch 'origin/5.8' into devJ-P Nurmi2017-01-111-1/+1
|\ | | | | | | Change-Id: If797ac58344b20e8de4379343131c097247ba2f2
| * Welcome to 2017J-P Nurmi2017-01-091-1/+1
| | | | | | | | | | Change-Id: If68cff4efacc7dc5719c8b8e61937e85e9076870 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Merge remote-tracking branch 'origin/5.8' into devJ-P Nurmi2017-01-051-1/+1
|\| | | | | | | | | | | | | | | Conflicts: .qmake.conf examples/quickcontrols2/quickcontrols2.pro Change-Id: If2f5e40487ba6515ba322f92380573727bdd6bc0
| * QQuickDial: account for when the wheel event is invertedJ-P Nurmi2017-01-051-1/+1
| | | | | | | | | | | | | | | | On macOS, the vertical scrolling with the wheel may be inverted, so we need to account for this when getting the y angle. Change-Id: Ia0f59beba905beff7b0cf12271a654c721bd5179 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* | QQuickDial: handle touch eventsJ-P Nurmi2017-01-031-0/+62
| | | | | | | | | | | | | | | | | | | | In comparison to handling synthesized mouse events, handling touch events has the advantage that it gives multi-touch support. That is, it is possible to move multiple dials at the same time, each handling its own touch point. Change-Id: Icabd971147f291fa4df00c6215c847d7976fda5f Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Revise QQuickDial internalsJ-P Nurmi2017-01-031-36/+64
| | | | | | | | | | | | | | | | Move the press/move/release/ungrab logic from mouse event handlers to QQuickDialPrivate methods that can be re-used for touch events. Change-Id: I6e4594a3b532d6049117a37b0880e16cc22cb6cf Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | QQuickDial: operate on floating point coordinatesJ-P Nurmi2017-01-031-14/+14
| | | | | | | | | | | | | | | | | | Store the press point as QPointF, and pass also QPointF to QQuickDialPrivate::positionAt(). This makes it easier to add touch event handling later. Change-Id: I256cc5039a7f52a0a04dffa800763898f321b100 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Doc: tweak wording for the moved() signalsJ-P Nurmi2016-12-021-1/+1
| | | | | | | | | | Change-Id: I932ed06617cf237c20a1473f4f4270898ad83337 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Merge remote-tracking branch 'origin/5.8' into devJ-P Nurmi2016-12-011-0/+14
|\| | | | | | | | | | | | | | | | | | | Conflicts: src/imports/controls/SpinBox.qml src/imports/controls/material/SpinBox.qml src/imports/controls/universal/SpinBox.qml tests/auto/controls/data/tst_swipedelegate.qml Change-Id: Ie1d1f487890f0a9f80a00df5e813e1d2e8303fe5
| * Dial: add missing wheel handlingJ-P Nurmi2016-11-291-0/+14
| | | | | | | | | | | | | | | | [ChangeLog][Controls][Dial] Added support for wheel handling when wheelEnabled is set to true. Change-Id: If0bc2f0ea9d7cde7726739cdfdbd795c908981f0 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Add Dial::moved() signalJ-P Nurmi2016-11-291-0/+17
| | | | | | | | | | | | | | | | | | | | [ChangeLog][Controls][Dial] Added a moved() signal that is emitted whenever the dial is interactively moved by the user by using either touch, mouse, or keys. Task-number: QTBUG-57203 Change-Id: I4b4224309f11bdcafd5c7b88414d80ebe2616238 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Merge remote-tracking branch 'origin/5.8' into devJ-P Nurmi2016-11-171-2/+2
|\| | | | | | | | | | | | | | | Conflicts: src/quickcontrols2/qquickstyle.cpp src/quicktemplates2/qquickslider.cpp Change-Id: Ie12132690680706def6f516334a6ef0ba27336b3
| * Doc: rephase the "logical position" propertiesJ-P Nurmi2016-11-161-2/+2
| | | | | | | | | | | | | | | | | | The previous phrasing was poor and somewhat confusing. The logical position is expressed as a fraction of the value, in the range 0-1. Change-Id: I6c2a4cbb1385af69392d214dd02224ec876131e5 Task-number: QTBUG-57069 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Merge remote-tracking branch 'origin/5.8' into devJ-P Nurmi2016-11-031-1/+3
|\| | | | | | | | | | | | | | | | | | | | | Conflicts: src/imports/controls/BusyIndicator.qml src/imports/controls/ProgressBar.qml src/quicktemplates2/qquickpopup.cpp src/quicktemplates2/qquickpopup_p_p.h src/quicktemplates2/qquickstackview.cpp Change-Id: I9a1028a991de9fc3e26d3f973106301e9ada631c
| * Doc: revise brief descriptionsJ-P Nurmi2016-11-021-1/+1
| | | | | | | | | | | | Change-Id: If7bdd4c11aaeb2df87622c769b1a65ac82ac7e73 Task-number: QTBUG-55904 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
| * Doc: show the non-wrapping Dial GIF in the detailed descriptionJ-P Nurmi2016-11-021-0/+2
| | | | | | | | | | | | | | | | | | There was no screenshot in the detailed description. This helps to see right away what kind of control it is. Change-Id: I0ecc585a5e6f650112e88bb3b37a2f5140d41261 Task-number: QTBUG-55904 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Add QQuickDial::liveJ-P Nurmi2016-10-061-6/+40
|/ | | | | | | | | [ChangeLog][Controls][Dial] Added a live-property that determines whether the dial provides live updates for the value-property while the handle is dragged. Change-Id: I8da1190df1e9093f81271a8e11f2cea55759573f Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Dial: clarify the documentation for some propertiesMitch Curtis2016-09-191-2/+15
| | | | | | | | | | - Document the range of the angle property - Fix handle's property type - Explain stepSize more thoroughly Change-Id: I72ce8b493b3faf49d7f155ac802109bd9bdb4089 Task-number: QTBUG-55904 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* Delete replaced delegates after Component.completed() is emittedMitch Curtis2016-09-121-0/+1
| | | | | | | | | This avoids the issue "Object destroyed during incubation" error. A proper fix is still required in the QML engine. Change-Id: I3c168cfe2d8c295662bcb5886e99a0f95748e302 Task-number: QTBUG-50992 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* Dial: fix stepSize handlingMitch Curtis2016-08-101-2/+8
| | | | | | | | | | | As was done in for Slider in c4c803ce4: The correct formula for calculating the "range" or "span" is to-from, not from+(to-from), which is used in the formula for calculating value. Task-number: QTBUG-55228 Change-Id: Ic5463ef5ac5566efc5996aadd9ae39ec108d778f Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* Doc: add missing \since 5.7 tagsJ-P Nurmi2016-05-251-0/+1
| | | | | Change-Id: Ie4680c5dfadc95278215b688f4fc28577f557933 Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>