summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenning Gruendl <henning.gruendl@qt.io>2022-09-20 11:46:17 +0200
committerHenning Gründl <henning.gruendl@qt.io>2022-09-20 09:51:01 +0000
commit533090fb5e18f2cfcc599266ff6fd5f8e5374f8b (patch)
tree7e2d55a5190894792b6ef2dad06d07c67043ab5f
parent7fc3bac762fafc3fd1407b54e70c0aec25afee15 (diff)
downloadqt-creator-533090fb5e18f2cfcc599266ff6fd5f8e5374f8b.tar.gz
QmlDesigner: Fix StatesEditor scroll bar
Change-Id: I241a33906d06c6011cb618b96c039dfe91323809 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
-rw-r--r--share/qtcreator/qmldesigner/newstateseditor/Main.qml21
-rw-r--r--share/qtcreator/qmldesigner/newstateseditor/StateScrollBar.qml12
-rw-r--r--share/qtcreator/qmldesigner/newstateseditor/StateThumbnail.qml10
3 files changed, 27 insertions, 16 deletions
diff --git a/share/qtcreator/qmldesigner/newstateseditor/Main.qml b/share/qtcreator/qmldesigner/newstateseditor/Main.qml
index 1d6f6910dd..8f50d8f336 100644
--- a/share/qtcreator/qmldesigner/newstateseditor/Main.qml
+++ b/share/qtcreator/qmldesigner/newstateseditor/Main.qml
@@ -507,7 +507,6 @@ Rectangle {
x: scrollView.leftPadding
y: scrollView.height - height
width: scrollView.availableWidth
- active: scrollView.ScrollBar.vertical.active
orientation: Qt.Horizontal
}
@@ -516,20 +515,9 @@ Rectangle {
x: scrollView.mirrored ? 0 : scrollView.width - width
y: scrollView.topPadding
height: scrollView.availableHeight
- active: scrollView.ScrollBar.horizontal.active
orientation: Qt.Vertical
}
- flickableDirection: {
- if (frame.contentHeight <= scrollView.height)
- return Flickable.HorizontalFlick
-
- if (frame.contentWidth <= scrollView.width)
- return Flickable.VerticalFlick
-
- return Flickable.HorizontalAndVerticalFlick
- }
-
Flickable {
id: frame
boundsMovement: Flickable.StopAtBounds
@@ -543,6 +531,15 @@ Rectangle {
let ext = root.showExtendGroups ? (2 * root.extend) : 0
return innerGrid.height + ext
}
+ flickableDirection: {
+ if (frame.contentHeight <= scrollView.height)
+ return Flickable.HorizontalFlick
+
+ if (frame.contentWidth <= scrollView.width)
+ return Flickable.VerticalFlick
+
+ return Flickable.HorizontalAndVerticalFlick
+ }
Behavior on contentY {
NumberAnimation {
diff --git a/share/qtcreator/qmldesigner/newstateseditor/StateScrollBar.qml b/share/qtcreator/qmldesigner/newstateseditor/StateScrollBar.qml
index 68f766a10e..a284131bad 100644
--- a/share/qtcreator/qmldesigner/newstateseditor/StateScrollBar.qml
+++ b/share/qtcreator/qmldesigner/newstateseditor/StateScrollBar.qml
@@ -24,12 +24,17 @@
****************************************************************************/
import QtQuick
-import QtQuick.Controls
+import QtQuick.Templates as T
import StudioTheme 1.0 as StudioTheme
-ScrollBar {
+T.ScrollBar {
id: scrollBar
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
+
contentItem: Rectangle {
implicitWidth: scrollBar.interactive ? 6 : 2
implicitHeight: scrollBar.interactive ? 6 : 2
@@ -40,8 +45,7 @@ ScrollBar {
states: State {
name: "active"
- when: scrollBar.policy === ScrollBar.AlwaysOn
- || (scrollBar.active && scrollBar.size < 1.0)
+ when: scrollBar.active && scrollBar.size < 1.0
PropertyChanges {
target: scrollBar.contentItem
opacity: 0.75
diff --git a/share/qtcreator/qmldesigner/newstateseditor/StateThumbnail.qml b/share/qtcreator/qmldesigner/newstateseditor/StateThumbnail.qml
index a5d20f8533..83de652edb 100644
--- a/share/qtcreator/qmldesigner/newstateseditor/StateThumbnail.qml
+++ b/share/qtcreator/qmldesigner/newstateseditor/StateThumbnail.qml
@@ -286,11 +286,21 @@ Item {
}
Flickable {
+ id: frame
boundsMovement: Flickable.StopAtBounds
boundsBehavior: Flickable.StopAtBounds
interactive: true
contentWidth: column.width
contentHeight: column.height
+ flickableDirection: {
+ if (frame.contentHeight <= scrollView.height)
+ return Flickable.HorizontalFlick
+
+ if (frame.contentWidth <= scrollView.width)
+ return Flickable.VerticalFlick
+
+ return Flickable.HorizontalAndVerticalFlick
+ }
// ScrollView needs an extra TapHandler on top in order to receive click
// events. MouseAreas below ScrollView do not let clicks through.