diff options
-rw-r--r-- | src/imports/controls/RangeSlider.qml | 10 | ||||
-rw-r--r-- | src/imports/controls/doc/images/qtquickcontrols-rangeslider-track.png | bin | 1162 -> 0 bytes | |||
-rw-r--r-- | src/imports/controls/doc/snippets/qtquickcontrols-rangeslider-track.qml | 39 | ||||
-rw-r--r-- | src/imports/controls/doc/src/qtlabscontrols-customize.qdoc | 12 | ||||
-rw-r--r-- | src/imports/controls/material/RangeSlider.qml | 10 | ||||
-rw-r--r-- | src/imports/controls/plugins.qmltypes | 1 | ||||
-rw-r--r-- | src/imports/controls/universal/RangeSlider.qml | 18 | ||||
-rw-r--r-- | src/imports/templates/plugins.qmltypes | 1 | ||||
-rw-r--r-- | src/templates/qquickrangeslider.cpp | 30 | ||||
-rw-r--r-- | src/templates/qquickrangeslider_p.h | 5 |
10 files changed, 23 insertions, 103 deletions
diff --git a/src/imports/controls/RangeSlider.qml b/src/imports/controls/RangeSlider.qml index 9a74d4c8..8642a390 100644 --- a/src/imports/controls/RangeSlider.qml +++ b/src/imports/controls/RangeSlider.qml @@ -41,11 +41,11 @@ T.RangeSlider { id: control implicitWidth: Math.max(background ? background.implicitWidth : 0, - Math.max(track ? track.implicitWidth : 0, + Math.max(background ? background.implicitWidth : 0, first.handle ? first.handle.implicitWidth : 0, second.handle ? second.handle.implicitWidth : 0) + leftPadding + rightPadding) implicitHeight: Math.max(background ? background.implicitHeight : 0, - Math.max(track ? track.implicitHeight : 0, + Math.max(background ? background.implicitHeight : 0, first.handle ? first.handle.implicitHeight : 0, second.handle ? second.handle.implicitHeight : 0) + topPadding + bottomPadding) @@ -81,8 +81,8 @@ T.RangeSlider { } //! [secondHandle] - //! [track] - track: Rectangle { + //! [background] + background: Rectangle { x: control.leftPadding + (horizontal ? 0 : (control.availableWidth - width) / 2) y: control.topPadding + (horizontal ? (control.availableHeight - height) / 2 : 0) implicitWidth: horizontal ? 200 : 6 @@ -96,5 +96,5 @@ T.RangeSlider { readonly property bool horizontal: control.orientation === Qt.Horizontal } - //! [track] + //! [background] } diff --git a/src/imports/controls/doc/images/qtquickcontrols-rangeslider-track.png b/src/imports/controls/doc/images/qtquickcontrols-rangeslider-track.png Binary files differdeleted file mode 100644 index 63da8673..00000000 --- a/src/imports/controls/doc/images/qtquickcontrols-rangeslider-track.png +++ /dev/null diff --git a/src/imports/controls/doc/snippets/qtquickcontrols-rangeslider-track.qml b/src/imports/controls/doc/snippets/qtquickcontrols-rangeslider-track.qml deleted file mode 100644 index 858cb727..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols-rangeslider-track.qml +++ /dev/null @@ -1,39 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 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 Qt.labs.controls 1.0 - -RangeSlider { - first.value: 0.25 - second.value: 0.75 - Rectangle { - anchors.fill: track - color: "transparent" - border.color: "red" - } -} diff --git a/src/imports/controls/doc/src/qtlabscontrols-customize.qdoc b/src/imports/controls/doc/src/qtlabscontrols-customize.qdoc index 5e58444d..47702132 100644 --- a/src/imports/controls/doc/src/qtlabscontrols-customize.qdoc +++ b/src/imports/controls/doc/src/qtlabscontrols-customize.qdoc @@ -321,8 +321,8 @@ \section1 Customizing RangeSlider - RangeSlider consists of four visual items: - \l {Control::background}{background}, \l {RangeSlider::track}{track}, + RangeSlider consists of three visual items: + \l {Control::background}{background}, \l {RangeSlider::first}{first.handle} and \l {RangeSlider::second.handle}{second.handle}. @@ -330,13 +330,7 @@ \image qtquickcontrols-rangeslider-background.png - RangeSlider has no background item by default. - - \section3 Track - - \image qtquickcontrols-rangeslider-track.png - - \snippet RangeSlider.qml track + \snippet RangeSlider.qml background \section3 First Handle diff --git a/src/imports/controls/material/RangeSlider.qml b/src/imports/controls/material/RangeSlider.qml index 617f9ac7..ecafda70 100644 --- a/src/imports/controls/material/RangeSlider.qml +++ b/src/imports/controls/material/RangeSlider.qml @@ -43,11 +43,11 @@ T.RangeSlider { id: control implicitWidth: Math.max(background ? background.implicitWidth : 0, - Math.max(track ? track.implicitWidth : 0, + Math.max(background ? background.implicitWidth : 0, first.handle ? first.handle.implicitWidth : 0, second.handle ? second.handle.implicitWidth : 0) + leftPadding + rightPadding) implicitHeight: Math.max(background ? background.implicitHeight : 0, - Math.max(track ? track.implicitHeight : 0, + Math.max(background ? background.implicitHeight : 0, first.handle ? first.handle.implicitHeight : 0, second.handle ? second.handle.implicitHeight : 0) + topPadding + bottomPadding) @@ -73,8 +73,8 @@ T.RangeSlider { } //! [secondHandle] - //! [track] - track: Rectangle { + //! [background] + background: Rectangle { x: control.leftPadding + (horizontal ? 0 : (control.availableWidth - width) / 2) y: control.topPadding + (horizontal ? (control.availableHeight - height) / 2 : 0) implicitWidth: horizontal ? 200 : 1 @@ -95,5 +95,5 @@ T.RangeSlider { color: control.Material.accentColor } } - //! [track] + //! [background] } diff --git a/src/imports/controls/plugins.qmltypes b/src/imports/controls/plugins.qmltypes index ce3b528c..5bb504e3 100644 --- a/src/imports/controls/plugins.qmltypes +++ b/src/imports/controls/plugins.qmltypes @@ -471,7 +471,6 @@ Module { Property { name: "stepSize"; type: "double" } Property { name: "snapMode"; type: "SnapMode" } Property { name: "orientation"; type: "Qt::Orientation" } - Property { name: "track"; type: "QQuickItem"; isPointer: true } Method { name: "setValues" Parameter { name: "firstValue"; type: "double" } diff --git a/src/imports/controls/universal/RangeSlider.qml b/src/imports/controls/universal/RangeSlider.qml index f01c06ed..c9dfc8d0 100644 --- a/src/imports/controls/universal/RangeSlider.qml +++ b/src/imports/controls/universal/RangeSlider.qml @@ -42,11 +42,11 @@ T.RangeSlider { id: control implicitWidth: Math.max(background ? background.implicitWidth : 0, - Math.max(track ? track.implicitWidth : 0, + Math.max(background ? background.implicitWidth : 0, first.handle ? first.handle.implicitWidth : 0, second.handle ? second.handle.implicitWidth : 0) + leftPadding + rightPadding) implicitHeight: Math.max(background ? background.implicitHeight : 0, - Math.max(track ? track.implicitHeight : 0, + Math.max(background ? background.implicitHeight : 0, first.handle ? first.handle.implicitHeight : 0, second.handle ? second.handle.implicitHeight : 0) + topPadding + bottomPadding) @@ -82,8 +82,8 @@ T.RangeSlider { } //! [secondHandle] - //! [track] - track: Item { + //! [background] + background: Item { implicitWidth: horizontal ? 200 : 18 implicitHeight: horizontal ? 18 : 200 @@ -99,8 +99,8 @@ T.RangeSlider { Rectangle { x: parent.horizontal ? 0 : (parent.width - width) / 2 y: parent.horizontal ? (parent.height - height) / 2 : 0 - width: parent.horizontal ? parent.width : 2 // SliderTrackThemeHeight - height: !parent.horizontal ? parent.height : 2 // SliderTrackThemeHeight + width: parent.horizontal ? parent.width : 2 // SliderBackgroundThemeHeight + height: !parent.horizontal ? parent.height : 2 // SliderBackgroundThemeHeight color: control.enabled ? control.Universal.baseMediumLowColor : control.Universal.chromeDisabledHighColor } @@ -108,11 +108,11 @@ T.RangeSlider { Rectangle { x: parent.horizontal ? control.first.position * parent.width : 0 y: parent.horizontal ? (parent.height - height) / 2 : control.second.visualPosition * parent.height - width: parent.horizontal ? control.second.position * parent.width - control.first.position * parent.width : 2 // SliderTrackThemeHeight - height: !parent.horizontal ? control.second.position * parent.height - control.first.position * parent.height : 2 // SliderTrackThemeHeight + width: parent.horizontal ? control.second.position * parent.width - control.first.position * parent.width : 2 // SliderBackgroundThemeHeight + height: !parent.horizontal ? control.second.position * parent.height - control.first.position * parent.height : 2 // SliderBackgroundThemeHeight color: control.enabled ? control.Universal.accent : control.Universal.chromeDisabledHighColor } } - //! [track] + //! [background] } diff --git a/src/imports/templates/plugins.qmltypes b/src/imports/templates/plugins.qmltypes index 2604c6e8..6237f9be 100644 --- a/src/imports/templates/plugins.qmltypes +++ b/src/imports/templates/plugins.qmltypes @@ -465,7 +465,6 @@ Module { Property { name: "stepSize"; type: "double" } Property { name: "snapMode"; type: "SnapMode" } Property { name: "orientation"; type: "Qt::Orientation" } - Property { name: "track"; type: "QQuickItem"; isPointer: true } Method { name: "setValues" Parameter { name: "firstValue"; type: "double" } diff --git a/src/templates/qquickrangeslider.cpp b/src/templates/qquickrangeslider.cpp index b4bc7b1c..3de7106b 100644 --- a/src/templates/qquickrangeslider.cpp +++ b/src/templates/qquickrangeslider.cpp @@ -302,8 +302,7 @@ public: first(nullptr), second(nullptr), orientation(Qt::Horizontal), - snapMode(QQuickRangeSlider::NoSnap), - track(nullptr) + snapMode(QQuickRangeSlider::NoSnap) { } @@ -315,7 +314,6 @@ public: QPoint pressPoint; Qt::Orientation orientation; QQuickRangeSlider::SnapMode snapMode; - QQuickItem *track; }; static qreal valueAt(const QQuickRangeSlider *slider, qreal position) @@ -615,32 +613,6 @@ void QQuickRangeSlider::setOrientation(Qt::Orientation orientation) } /*! - \qmlproperty Item Qt.labs.controls::RangeSlider::track - - This property holds the track item. - - \sa {Customizing Slider} -*/ -QQuickItem *QQuickRangeSlider::track() const -{ - Q_D(const QQuickRangeSlider); - return d->track; -} - -void QQuickRangeSlider::setTrack(QQuickItem *track) -{ - Q_D(QQuickRangeSlider); - if (d->track == track) - return; - - delete d->track; - d->track = track; - if (track && !track->parentItem()) - track->setParentItem(this); - emit trackChanged(); -} - -/*! \qmlmethod void Qt.labs.controls::RangeSlider::setValues(real firstValue, real secondValue) Sets \l first.value and \l second.value with the given arguments. diff --git a/src/templates/qquickrangeslider_p.h b/src/templates/qquickrangeslider_p.h index ba51713c..7eda2e4e 100644 --- a/src/templates/qquickrangeslider_p.h +++ b/src/templates/qquickrangeslider_p.h @@ -65,7 +65,6 @@ class Q_QUICKTEMPLATES_EXPORT QQuickRangeSlider : public QQuickControl Q_PROPERTY(qreal stepSize READ stepSize WRITE setStepSize NOTIFY stepSizeChanged FINAL) Q_PROPERTY(SnapMode snapMode READ snapMode WRITE setSnapMode NOTIFY snapModeChanged FINAL) Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged FINAL) - Q_PROPERTY(QQuickItem *track READ track WRITE setTrack NOTIFY trackChanged FINAL) public: explicit QQuickRangeSlider(QQuickItem *parent = nullptr); @@ -95,9 +94,6 @@ public: Qt::Orientation orientation() const; void setOrientation(Qt::Orientation orientation); - QQuickItem *track() const; - void setTrack(QQuickItem *track); - Q_INVOKABLE void setValues(qreal firstValue, qreal secondValue); Q_SIGNALS: @@ -106,7 +102,6 @@ Q_SIGNALS: void stepSizeChanged(); void snapModeChanged(); void orientationChanged(); - void trackChanged(); protected: void focusInEvent(QFocusEvent *event) override; |