diff options
Diffstat (limited to 'src/imports/controls/material/RangeSlider.qml')
-rw-r--r-- | src/imports/controls/material/RangeSlider.qml | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/src/imports/controls/material/RangeSlider.qml b/src/imports/controls/material/RangeSlider.qml index bf8c16ef..dc2c25fa 100644 --- a/src/imports/controls/material/RangeSlider.qml +++ b/src/imports/controls/material/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,24 +35,22 @@ ****************************************************************************/ import QtQuick 2.6 -import Qt.labs.templates 1.0 as T -import Qt.labs.controls.material 1.0 +import QtQuick.Templates 2.0 as T +import QtQuick.Controls.Material 2.0 +import QtQuick.Controls.Material.impl 2.0 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: SliderHandle { 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)) @@ -60,9 +58,7 @@ T.RangeSlider { handleHasFocus: activeFocus handlePressed: first.pressed } - //! [firstHandle] - //! [secondHandle] second.handle: SliderHandle { 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)) @@ -70,16 +66,14 @@ T.RangeSlider { handleHasFocus: activeFocus handlePressed: second.pressed } - //! [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 : 1 - implicitHeight: horizontal ? 1 : 200 - width: horizontal ? control.availableWidth : implicitWidth - height: horizontal ? implicitHeight : control.availableHeight + implicitWidth: horizontal ? 200 : 48 + implicitHeight: horizontal ? 48 : 200 + width: horizontal ? control.availableWidth : 1 + height: horizontal ? 1 : control.availableHeight color: control.Material.primaryTextColor scale: horizontal && control.mirrored ? -1 : 1 @@ -94,5 +88,4 @@ T.RangeSlider { color: control.Material.accentColor } } - //! [track] } |