QmlDesigner: Fix StatesEditor scroll bar

Change-Id: I241a33906d06c6011cb618b96c039dfe91323809
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Henning Gruendl
2022-09-20 11:46:17 +02:00
committed by Henning Gründl
parent 7fc3bac762
commit 533090fb5e
3 changed files with 27 additions and 16 deletions

View File

@@ -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 {

View File

@@ -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

View File

@@ -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.