diff options
Diffstat (limited to 'src/quickcontrols/macos/ScrollBar.qml')
-rw-r--r-- | src/quickcontrols/macos/ScrollBar.qml | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/quickcontrols/macos/ScrollBar.qml b/src/quickcontrols/macos/ScrollBar.qml new file mode 100644 index 0000000000..d025b0546a --- /dev/null +++ b/src/quickcontrols/macos/ScrollBar.qml @@ -0,0 +1,32 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +import QtQuick +import QtQuick.NativeStyle as NativeStyle + +NativeStyle.DefaultScrollBar { + id: controlRoot + + contentItem: NativeStyle.ScrollBar { + control: controlRoot + subControl: NativeStyle.ScrollBar.Handle + overrideState: NativeStyle.ScrollBar.NeverHovered + opacity: 0.5 + } + + NativeStyle.ScrollBar { + // Fade a hovered-looking version of the handle + // on top of the default handle when hovering it + x: contentItem.x + y: contentItem.y + width: contentItem.width + height: contentItem.height + control: controlRoot + subControl: NativeStyle.ScrollBar.Handle + overrideState: NativeStyle.StyleItem.AlwaysHovered + opacity: controlRoot.hovered || control.pressed ? 0.5 : 0 + visible: contentItem instanceof NativeStyle.StyleItem + Behavior on opacity { NumberAnimation { duration: contentItem.transitionDuration } } + } + +} |