aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/studiowelcome/qml
diff options
context:
space:
mode:
authorThomas Hartmann <thomas.hartmann@qt.io>2021-06-15 14:24:06 +0200
committerThomas Hartmann <thomas.hartmann@qt.io>2021-06-15 16:17:49 +0000
commit1f8f1d620fdb32c81cd5f8a1d8e4f0a348f78d60 (patch)
treea17cf998c1e36ea1b4f92bf8cf723e3cef7c4198 /src/plugins/studiowelcome/qml
parentf62d3c7266f7ed36e55f60f4c83e745124b7f02f (diff)
StudioWelcome: Use custom scroll bars
The default style on Windows with Qt 6 does not fit. Change-Id: I9e0a8ad411a28744a333b768c493248aa5a1c9db Reviewed-by: Tim Jenssen <tim.jenssen@qt.io> Reviewed-by: Brook Cronin <brook.cronin@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Diffstat (limited to 'src/plugins/studiowelcome/qml')
-rw-r--r--src/plugins/studiowelcome/qml/welcomepage/CustomScrollBar.qml57
-rw-r--r--src/plugins/studiowelcome/qml/welcomepage/CustomScrollView.qml42
-rw-r--r--src/plugins/studiowelcome/qml/welcomepage/main.qml8
3 files changed, 102 insertions, 5 deletions
diff --git a/src/plugins/studiowelcome/qml/welcomepage/CustomScrollBar.qml b/src/plugins/studiowelcome/qml/welcomepage/CustomScrollBar.qml
new file mode 100644
index 0000000000..f372165a78
--- /dev/null
+++ b/src/plugins/studiowelcome/qml/welcomepage/CustomScrollBar.qml
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+import QtQuick 2.15
+import QtQuick.Templates 2.15 as Controls
+import welcome 1.0
+
+Controls.ScrollBar {
+ id: scrollBar
+
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
+
+ padding: control.interactive ? 1 : 2
+ visible: control.policy !== Controls.ScrollBar.AlwaysOff
+ minimumSize: orientation == Qt.Horizontal ? height / width : width / height
+
+ contentItem: Rectangle {
+ implicitWidth: 13
+ implicitHeight: 13
+
+ color: Constants.textDefaultColor
+ }
+
+ background: Rectangle {
+ implicitWidth: 16
+ implicitHeight: 16
+ color: "#2d2e30"
+ visible: control.interactive
+ }
+}
+
+
diff --git a/src/plugins/studiowelcome/qml/welcomepage/CustomScrollView.qml b/src/plugins/studiowelcome/qml/welcomepage/CustomScrollView.qml
new file mode 100644
index 0000000000..a440cc68af
--- /dev/null
+++ b/src/plugins/studiowelcome/qml/welcomepage/CustomScrollView.qml
@@ -0,0 +1,42 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+import QtQuick.Templates 2.15 as Controls
+
+Controls.ScrollView {
+ id: control
+
+ Controls.ScrollBar.vertical: CustomScrollBar {
+ parent: control
+ x: control.mirrored ? 0 : control.width - width
+ y: control.topPadding
+ height: control.availableHeight
+ active: control.ScrollBar.horizontal.active
+ }
+
+ Controls.ScrollBar.horizontal: CustomScrollBar {
+ visible: false
+ }
+}
diff --git a/src/plugins/studiowelcome/qml/welcomepage/main.qml b/src/plugins/studiowelcome/qml/welcomepage/main.qml
index 771f484585..4d6f8cfae4 100644
--- a/src/plugins/studiowelcome/qml/welcomepage/main.qml
+++ b/src/plugins/studiowelcome/qml/welcomepage/main.qml
@@ -48,7 +48,7 @@ Item {
anchors.right: parent.right
anchors.left: parent.left
- ScrollView{
+ CustomScrollView {
ProjectsGrid {
model: ProjectModel {
id: projectModel
@@ -57,14 +57,14 @@ Item {
}
}
- ScrollView {
+ CustomScrollView {
ProjectsGrid {
model: ExamplesModel {}
onItemSelected: projectModel.openExample(item.projectName, item.qmlFileName, item.url)
}
}
- ScrollView{
+ CustomScrollView{
ProjectsGrid {
model: TutorialsModel {}
onItemSelected: Qt.openUrlExternally(item.url)
@@ -100,8 +100,6 @@ Item {
MyTabButton {
text: qsTr("Recent Projects")
- bottomPadding: 6
- topPadding: 6.8
checked: true
onClicked: stackLayout.currentIndex = 0
}