diff options
Diffstat (limited to 'src/imports/controls/material/Slider.qml')
-rw-r--r-- | src/imports/controls/material/Slider.qml | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/src/imports/controls/material/Slider.qml b/src/imports/controls/material/Slider.qml index 139c9151..15c8edb2 100644 --- a/src/imports/controls/material/Slider.qml +++ b/src/imports/controls/material/Slider.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,52 +35,47 @@ ****************************************************************************/ 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.Slider { id: control implicitWidth: Math.max(background ? background.implicitWidth : 0, - Math.max(track ? track.implicitWidth : 0, - handle ? handle.implicitWidth : 0) + leftPadding + rightPadding) + (handle ? handle.implicitWidth : 0) + leftPadding + rightPadding) implicitHeight: Math.max(background ? background.implicitHeight : 0, - Math.max(track ? track.implicitHeight : 0, - handle ? handle.implicitHeight : 0) + topPadding + bottomPadding) + (handle ? handle.implicitHeight : 0) + topPadding + bottomPadding) padding: 6 - //! [handle] handle: SliderHandle { x: control.leftPadding + (horizontal ? control.visualPosition * (control.availableWidth - width) : (control.availableWidth - width) / 2) y: control.topPadding + (horizontal ? (control.availableHeight - height) / 2 : control.visualPosition * (control.availableHeight - height)) value: control.value - handleHasFocus: control.activeFocus + handleHasFocus: control.visualFocus handlePressed: control.pressed } - //! [handle] - //! [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 ? 1 : control.position * implicitHeight - 4 + 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 readonly property bool horizontal: control.orientation === Qt.Horizontal Rectangle { - x: 0 - y: parent.horizontal ? -1 : control.visualPosition * parent.height + 3 + x: parent.horizontal ? 0 : (parent.width - width) / 2 + y: parent.horizontal ? (parent.height - height) / 2 : control.visualPosition * parent.height width: parent.horizontal ? control.position * parent.width : 3 - height: parent.horizontal ? 3 : control.availableHeight + height: parent.horizontal ? 3 : control.position * parent.height color: control.Material.accentColor } } - //! [track] } |