diff options
author | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2020-09-28 15:42:35 +0200 |
---|---|---|
committer | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2020-09-29 14:33:52 +0200 |
commit | 5b711c1cb719d1147791ce23c43133a29d10a807 (patch) | |
tree | cc06b587fa4f7d0d38f3e857b9df75e2823909fd /src/imports/controls/macos | |
parent | ad25ebd08247579754243b09f8fa60b778d9a3aa (diff) |
Implement ScrollView.qml in all styles
ScrollView.qml makes use of ScrollBar. While most of the
styles override ScrollBar.qml, almost none override
ScrollView.qml. This means that the ScrollView in
Basic style will be used, and that ScrollView will
always use it's own scrollbars, regardless if the
overridden style provides another ScrollBar.qml.
This patch will override ScrollView.qml for all the
internal styles so that the correct scrollbars will
be used.
Change-Id: I1d9ba17f225a82b2dfaae6caba6ac4519f79a705
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/imports/controls/macos')
-rw-r--r-- | src/imports/controls/macos/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/imports/controls/macos/ScrollView.qml | 64 | ||||
-rw-r--r-- | src/imports/controls/macos/macos.pri | 1 | ||||
-rw-r--r-- | src/imports/controls/macos/qmldir | 1 |
4 files changed, 67 insertions, 0 deletions
diff --git a/src/imports/controls/macos/CMakeLists.txt b/src/imports/controls/macos/CMakeLists.txt index 59a1a1f7..1cb9ff86 100644 --- a/src/imports/controls/macos/CMakeLists.txt +++ b/src/imports/controls/macos/CMakeLists.txt @@ -50,6 +50,7 @@ set(qml_files "Frame.qml" "TextArea.qml" "ComboBox.qml" + "ScrollView.qml" "ScrollBar.qml" "ProgressBar.qml" "Dial.qml" diff --git a/src/imports/controls/macos/ScrollView.qml b/src/imports/controls/macos/ScrollView.qml new file mode 100644 index 00000000..a6bba9de --- /dev/null +++ b/src/imports/controls/macos/ScrollView.qml @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick +import QtQuick.Controls.impl +import QtQuick.Templates as T + +T.ScrollView { + id: control + + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, + contentWidth + leftPadding + rightPadding) + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + contentHeight + topPadding + bottomPadding) + + ScrollBar.vertical: ScrollBar { + parent: control + x: control.mirrored ? 0 : control.width - width + y: control.topPadding + height: control.availableHeight + active: control.ScrollBar.horizontal.active + } + + ScrollBar.horizontal: ScrollBar { + parent: control + x: control.leftPadding + y: control.height - height + width: control.availableWidth + active: control.ScrollBar.vertical.active + } +} diff --git a/src/imports/controls/macos/macos.pri b/src/imports/controls/macos/macos.pri index 98474a92..d059151e 100644 --- a/src/imports/controls/macos/macos.pri +++ b/src/imports/controls/macos/macos.pri @@ -9,6 +9,7 @@ QML_FILES += \ $$PWD/Frame.qml \ $$PWD/TextArea.qml \ $$PWD/ComboBox.qml \ + $$PWD/ScrollView.qml \ $$PWD/ScrollBar.qml \ $$PWD/ProgressBar.qml \ $$PWD/Dial.qml \ diff --git a/src/imports/controls/macos/qmldir b/src/imports/controls/macos/qmldir index ea71d8fc..43130514 100644 --- a/src/imports/controls/macos/qmldir +++ b/src/imports/controls/macos/qmldir @@ -13,6 +13,7 @@ TextField 6.0 TextField.qml Frame 6.0 Frame.qml TextArea 6.0 TextArea.qml ComboBox 6.0 ComboBox.qml +ScrollView 6.0 ScrollView.qml ScrollBar 6.0 ScrollBar.qml ProgressBar 6.0 ProgressBar.qml Dial 6.0 Dial.qml |