aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2/qquickdial.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* Doc: cleanup remaining "labs" referencesJ-P Nurmi2016-04-211-2/+0
| | | | | Change-Id: I5b0015476c3ceef8f82b00d99b084b1ce3bfaa6f Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* Doc: rename Qt.labs.controls 1.0 to QtQuick.Controls 2.0J-P Nurmi2016-04-211-13/+13
| | | | | | Change-Id: Id6c476424fa359d222f027584278346fc0984069 Task-number: QTBUG-52549 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* Dial: make wrap default to falseMitch Curtis2016-04-211-2/+2
| | | | | | | | This is a safer default considering that potential applications of the dial include controlling audio volume. Change-Id: I343a6b758a795190e4b0ad9bdfc5766cbb6cb3bc Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* Add GIFs for DialMitch Curtis2016-04-211-3/+11
| | | | | Change-Id: I9b3670e9976a4b743f49a0eae3939e99944ea277 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* Dial: add wrap propertyMitch Curtis2016-04-191-3/+45
| | | | | | | | | | | | | | | | | This works by preventing changes in position that are considered too large. A change is considered too large when the difference between the old and new positions is greater than or equal to 0.5 *and* the position of the mouse is below the center of the dial. This effectively makes it impossible to drag the dial from left to right when the mouse is below its center, but still allows doing so above its center. This is useful for applications such as volume dials, where a large change can be dangerous. Change-Id: I1d7800e5ba16dbe0642974b8e53d8fcd921a01d7 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* Move angle calculation to static global variable.Mitch Curtis2016-04-191-1/+3
| | | | | | | | | This also: - gives names to what were pretty odd looking expressions - rewrites those expressions to be easier to understand Change-Id: Ia06d5702590d10cc53b9ae939a6877b6c403e091 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* Templates: update license headersJ-P Nurmi2016-04-141-2/+2
| | | | | | | This file is part of the Qt Quick Templates 2 module of the Qt Toolkit. Change-Id: I39ef9cbb00f55a32b7a43f11ffbdfbb40b84e124 Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>