diff options
Diffstat (limited to 'src/imports/controls/universal/ScrollBar.qml')
-rw-r--r-- | src/imports/controls/universal/ScrollBar.qml | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/src/imports/controls/universal/ScrollBar.qml b/src/imports/controls/universal/ScrollBar.qml index dd0a81ca..1ac627a7 100644 --- a/src/imports/controls/universal/ScrollBar.qml +++ b/src/imports/controls/universal/ScrollBar.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,37 +35,28 @@ ****************************************************************************/ import QtQuick 2.6 -import Qt.labs.templates 1.0 as T -import Qt.labs.controls.universal 1.0 +import QtQuick.Templates 2.0 as T +import QtQuick.Controls.Universal 2.0 T.ScrollBar { id: control implicitWidth: Math.max(background ? background.implicitWidth : 0, - handle.implicitWidth + leftPadding + rightPadding) + contentItem.implicitWidth + leftPadding + rightPadding) implicitHeight: Math.max(background ? background.implicitHeight : 0, - handle.implicitHeight + topPadding + bottomPadding) + contentItem.implicitHeight + topPadding + bottomPadding) // TODO: arrows - //! [handle] - handle: Rectangle { + contentItem: Rectangle { implicitWidth: 12 implicitHeight: 12 color: control.pressed ? control.Universal.baseMediumColor : control.Universal.chromeHighColor visible: control.size < 1.0 opacity: 0.0 - - readonly property bool horizontal: control.orientation === Qt.Horizontal - x: control.leftPadding + (horizontal ? control.position * control.availableWidth : 0) - y: control.topPadding + (horizontal ? 0 : control.position * control.availableHeight) - width: horizontal ? control.size * control.availableWidth : implicitWidth - height: horizontal ? implicitHeight : control.size * control.availableHeight } - //! [handle] - //! [background] background: Rectangle { implicitWidth: 12 implicitHeight: 12 @@ -74,7 +65,6 @@ T.ScrollBar { visible: control.size < 1.0 opacity: 0.0 } - //! [background] states: [ State { @@ -86,13 +76,13 @@ T.ScrollBar { transitions: [ Transition { to: "active" - NumberAnimation { targets: [handle, background]; property: "opacity"; to: 1.0 } + NumberAnimation { targets: [contentItem, background]; property: "opacity"; to: 1.0 } }, Transition { from: "active" SequentialAnimation { PauseAnimation { duration: 3000 } - NumberAnimation { targets: [handle, background]; property: "opacity"; to: 0.0 } + NumberAnimation { targets: [contentItem, background]; property: "opacity"; to: 0.0 } } } ] |