diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2017-01-27 12:50:17 +0100 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2017-01-27 13:37:47 +0000 |
commit | b026ebf67a95c6bca186e69e6e71b6fb70b4eeb3 (patch) | |
tree | aa2230cf29158360c3a1869ee121b96ed37c8da7 /src | |
parent | 8968ce178453c3b6a74b95ba34fb492fd29ef764 (diff) |
Default QQuickSlider::live to true
[ChangeLog][Important Behavior Changes] On a popular demand, Slider
has been changed to report live value updates. This can be disabled
by setting Slider::live to false.
Change-Id: I48c6a92eb794d2846cfff96d8784c53c22843573
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-slider.qml | 53 | ||||
-rw-r--r-- | src/quicktemplates2/qquickslider.cpp | 21 |
2 files changed, 5 insertions, 69 deletions
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-slider.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-slider.qml deleted file mode 100644 index fc2790b0..00000000 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-slider.qml +++ /dev/null @@ -1,53 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: http://www.gnu.org/copyleft/fdl.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Window 2.2 -import QtQuick.Controls 2.1 - -Item { - id: root - width: slider.width - height: slider.height * 2.0 - - Binding { target: slider.anchors; property: "centerIn"; value: root } - Binding { target: slider.anchors; property: "verticalCenterOffset"; value: slider.height / 2 } - Binding { target: slider; property: "pressed"; value: root.Window.active } - - //! [1] - Slider { - id: slider - value: 0.5 - - ToolTip { - parent: slider.handle - visible: slider.pressed - text: slider.valueAt(slider.position).toFixed(1) - } - } - //! [1] -} diff --git a/src/quicktemplates2/qquickslider.cpp b/src/quicktemplates2/qquickslider.cpp index ff41595b..c95385dd 100644 --- a/src/quicktemplates2/qquickslider.cpp +++ b/src/quicktemplates2/qquickslider.cpp @@ -94,7 +94,7 @@ public: value(0), position(0), stepSize(0), - live(false), + live(true), pressed(false), touchId(-1), orientation(Qt::Horizontal), @@ -304,12 +304,7 @@ void QQuickSlider::setTo(qreal to) This property holds the value in the range \c from - \c to. The default value is \c 0.0. - Unlike the \l position property, the \c value is not updated by default - while the handle is dragged, but only after the value has been chosen and - the slider has been released. The \l live property can be used to make the - slider provide live updates for the \c value property. - - \sa position, live, valueAt() + \sa position */ qreal QQuickSlider::value() const { @@ -338,8 +333,7 @@ void QQuickSlider::setValue(qreal value) This property holds the logical position of the handle. The position is expressed as a fraction of the control's size, in the range - \c {0.0 - 1.0}. The \c position is continuously updated while the - handle is dragged. For visualizing a slider, the right-to-left aware + \c {0.0 - 1.0}. For visualizing a slider, the right-to-left aware \l visualPosition should be used instead. \sa value, visualPosition, valueAt() @@ -441,9 +435,9 @@ void QQuickSlider::setSnapMode(SnapMode mode) This property holds whether the slider provides live updates for the \l value property while the handle is dragged. - The default value is \c false. + The default value is \c true. - \sa value + \sa value, valueAt() */ bool QQuickSlider::live() const { @@ -540,11 +534,6 @@ void QQuickSlider::setHandle(QQuickItem *handle) Returns the value for the given \a position. - The \l value property is not updated while the handle is dragged, but this - method can be used to get continuous value updates: - - \snippet qtquickcontrols2-tooltip-slider.qml 1 - \sa value, position */ qreal QQuickSlider::valueAt(qreal position) const |