diff options
Diffstat (limited to 'src/imports/controls/RangeSlider.qml')
-rw-r--r-- | src/imports/controls/RangeSlider.qml | 35 |
1 files changed, 13 insertions, 22 deletions
diff --git a/src/imports/controls/RangeSlider.qml b/src/imports/controls/RangeSlider.qml index 9a74d4c8..181550a4 100644 --- a/src/imports/controls/RangeSlider.qml +++ b/src/imports/controls/RangeSlider.qml @@ -1,9 +1,9 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. +** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Labs Controls module of the Qt Toolkit. +** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL3$ ** Commercial License Usage @@ -35,23 +35,20 @@ ****************************************************************************/ import QtQuick 2.6 -import Qt.labs.templates 1.0 as T +import QtQuick.Templates 2.0 as T T.RangeSlider { id: control implicitWidth: Math.max(background ? background.implicitWidth : 0, - Math.max(track ? track.implicitWidth : 0, - first.handle ? first.handle.implicitWidth : 0, - second.handle ? second.handle.implicitWidth : 0) + leftPadding + rightPadding) + Math.max(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, - first.handle ? first.handle.implicitHeight : 0, - second.handle ? second.handle.implicitHeight : 0) + topPadding + bottomPadding) + Math.max(first.handle ? first.handle.implicitHeight : 0, + second.handle ? second.handle.implicitHeight : 0) + topPadding + bottomPadding) padding: 6 - //! [firstHandle] first.handle: Rectangle { x: control.leftPadding + (horizontal ? control.first.visualPosition * (control.availableWidth - width) : (control.availableWidth - width) / 2) y: control.topPadding + (horizontal ? (control.availableHeight - height) / 2 : control.first.visualPosition * (control.availableHeight - height)) @@ -59,14 +56,12 @@ T.RangeSlider { implicitHeight: 28 radius: width / 2 border.width: activeFocus ? 2 : 1 - border.color: "#353637" - color: first.pressed ? "#bdbebf" : "#ffffff" + border.color: control.enabled ? (activeFocus ? "#0066ff" : (control.first.pressed ? "#808080" : "#909090")) : "#d6d6d6" + color: control.enabled ? (first.pressed ? (activeFocus ? "#cce0ff" : "#f6f6f6") : (activeFocus ? "#f0f6ff" : "#ffffff")) : "#fdfdfd" readonly property bool horizontal: control.orientation === Qt.Horizontal } - //! [firstHandle] - //! [secondHandle] second.handle: Rectangle { x: control.leftPadding + (horizontal ? control.second.visualPosition * (control.availableWidth - width) : (control.availableWidth - width) / 2) y: control.topPadding + (horizontal ? (control.availableHeight - height) / 2 : control.second.visualPosition * (control.availableHeight - height)) @@ -74,15 +69,13 @@ T.RangeSlider { implicitHeight: 28 radius: width / 2 border.width: activeFocus ? 2 : 1 - border.color: "#353637" - color: second.pressed ? "#bdbebf" : "#ffffff" + border.color: control.enabled ? (activeFocus ? "#0066ff" : (control.first.pressed ? "#808080" : "#909090")) : "#d6d6d6" + color: control.enabled ? (second.pressed ? (activeFocus ? "#cce0ff" : "#f6f6f6") : (activeFocus ? "#f0f6ff" : "#ffffff")) : "#fdfdfd" readonly property bool horizontal: control.orientation === Qt.Horizontal } - //! [secondHandle] - //! [track] - track: Rectangle { + background: Rectangle { x: control.leftPadding + (horizontal ? 0 : (control.availableWidth - width) / 2) y: control.topPadding + (horizontal ? (control.availableHeight - height) / 2 : 0) implicitWidth: horizontal ? 200 : 6 @@ -90,11 +83,9 @@ T.RangeSlider { width: horizontal ? control.availableWidth : implicitWidth height: horizontal ? implicitHeight : control.availableHeight radius: 3 - border.color: "#353637" - color: "#ffffff" + color: "#e0e0e0" scale: horizontal && control.mirrored ? -1 : 1 readonly property bool horizontal: control.orientation === Qt.Horizontal } - //! [track] } |