diff options
Diffstat (limited to 'src/imports/controls/material/ScrollBar.qml')
-rw-r--r-- | src/imports/controls/material/ScrollBar.qml | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/src/imports/controls/material/ScrollBar.qml b/src/imports/controls/material/ScrollBar.qml index 72130c63..84f2d33a 100644 --- a/src/imports/controls/material/ScrollBar.qml +++ b/src/imports/controls/material/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,21 +35,23 @@ ****************************************************************************/ 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 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) padding: 2 + topPadding: padding + (control.orientation === Qt.Horizontal ? 12 : 0) + leftPadding: padding + (control.orientation === Qt.Vertical && !control.mirrored ? 12 : 0) + rightPadding: padding + (control.orientation === Qt.Vertical && control.mirrored ? 12 : 0) - //! [handle] - handle: Rectangle { + contentItem: Rectangle { id: handle implicitWidth: 4 @@ -59,12 +61,6 @@ T.ScrollBar { 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 - states: State { name: "active" when: control.active @@ -79,5 +75,4 @@ T.ScrollBar { } } } - //! [handle] } |