Fix(desktopapp): adding scrollview to storybook

Cleaned up binding loop warnings related to
ScrollView and added StatusScrollView in
storybook

As part of #8864
This commit is contained in:
Alexandra Betouni 2023-01-26 10:41:07 +02:00 committed by Alexandra Betouni
parent f7294c00f5
commit 9a2ffc0fc7
12 changed files with 74 additions and 16 deletions

View File

@ -97,6 +97,10 @@ ListModel {
title: "StatusChatListAndCategories" title: "StatusChatListAndCategories"
section: "Components" section: "Components"
} }
ListElement {
title: "StatusScrollView"
section: "Components"
}
ListElement { ListElement {
title: "BrowserSettings" title: "BrowserSettings"
section: "Settings" section: "Settings"

View File

@ -0,0 +1,50 @@
import QtQuick 2.14
import QtQuick.Controls 2.14
import QtQuick.Layouts 1.14
import StatusQ.Core 0.1
import Storybook 1.0
import Models 1.0
import utils 1.0
SplitView {
id: root
Logs { id: logs }
SplitView {
orientation: Qt.Vertical
SplitView.fillWidth: true
Loader {
SplitView.fillWidth: true
SplitView.fillHeight: true
sourceComponent: StatusScrollView {
anchors.fill: parent
anchors.margins: 8
contentWidth: parent.width
contentHeight: rect.height
Rectangle {
id: rect
width: 300
height: 800
color: Qt.rgba(Math.random(), Math.random(), Math.random(), 255)
}
}
}
LogsAndControlsPanel {
id: logsAndControlsPanel
SplitView.minimumHeight: 100
SplitView.preferredHeight: 200
logsView.logText: logs.logText
}
}
Pane {
SplitView.minimumWidth: 300
SplitView.preferredWidth: 300
}
}

View File

@ -49,8 +49,6 @@ Flickable {
rightMargin: rightPadding rightMargin: rightPadding
contentWidth: contentItem.childrenRect.width contentWidth: contentItem.childrenRect.width
contentHeight: contentItem.childrenRect.height contentHeight: contentItem.childrenRect.height
implicitWidth: contentWidth + leftPadding + rightPadding
implicitHeight: contentHeight + topPadding + bottomPadding
boundsBehavior: Flickable.StopAtBounds boundsBehavior: Flickable.StopAtBounds
maximumFlickVelocity: 2000 maximumFlickVelocity: 2000
synchronousDrag: true synchronousDrag: true

View File

@ -36,6 +36,7 @@ StatusModal {
contentItem: StatusScrollView { contentItem: StatusScrollView {
id: scroll id: scroll
width: parent.width width: parent.width
height: parent.height
topPadding: 30 topPadding: 30
leftPadding: 20 leftPadding: 20
rightPadding: 20 rightPadding: 20

View File

@ -23,7 +23,7 @@ Item {
property alias cropRect: editor.cropRect property alias cropRect: editor.cropRect
property string imageData property string imageData
implicitHeight: layout.implicitHeight implicitHeight: layout.childrenRect.height
ColumnLayout { ColumnLayout {
id: layout id: layout

View File

@ -23,8 +23,7 @@ Item {
property alias cropRect: editor.cropRect property alias cropRect: editor.cropRect
property string imageData property string imageData
implicitWidth: layout.implicitWidth implicitHeight: layout.childrenRect.height
implicitHeight: layout.implicitHeight
ColumnLayout { ColumnLayout {
id: layout id: layout

View File

@ -6,7 +6,7 @@ import StatusQ.Core.Theme 0.1
import StatusQ.Components 0.1 import StatusQ.Components 0.1
import StatusQ.Controls 0.1 import StatusQ.Controls 0.1
ColumnLayout { Column {
id: root id: root
property alias archiveSupportEnabled: archiveSupportToggle.checked property alias archiveSupportEnabled: archiveSupportToggle.checked
@ -26,8 +26,8 @@ ColumnLayout {
RowLayout { RowLayout {
id: archiveSupport id: archiveSupport
Layout.fillWidth: true width: parent.width
Layout.preferredHeight: d.optionHeight height: d.optionHeight
StatusBaseText { StatusBaseText {
Layout.fillWidth: true Layout.fillWidth: true
@ -44,8 +44,8 @@ ColumnLayout {
} }
RowLayout { RowLayout {
Layout.fillWidth: true width: parent.width
Layout.preferredHeight: d.optionHeight height: d.optionHeight
StatusBaseText { StatusBaseText {
Layout.fillWidth: true Layout.fillWidth: true
@ -61,8 +61,8 @@ ColumnLayout {
} }
RowLayout { RowLayout {
Layout.fillWidth: true width: parent.width
Layout.preferredHeight: d.optionHeight height: d.optionHeight
StatusBaseText { StatusBaseText {
Layout.fillWidth: true Layout.fillWidth: true
@ -78,8 +78,8 @@ ColumnLayout {
} }
RowLayout { RowLayout {
Layout.fillWidth: true width: visible ? parent.width : 0
Layout.preferredHeight: d.optionHeight height: visible ? d.optionHeight : 0
visible: requestToJoinToggle.checked visible: requestToJoinToggle.checked
StatusBaseText { StatusBaseText {

View File

@ -159,6 +159,7 @@ StatusDropdown {
id: scrollView id: scrollView
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true
Layout.bottomMargin: 9 Layout.bottomMargin: 9
Layout.topMargin: Layout.topMargin:
!root.allowChoosingEntireCommunity && !root.allowChoosingEntireCommunity ? 9 : 0 !root.allowChoosingEntireCommunity && !root.allowChoosingEntireCommunity ? 9 : 0

View File

@ -25,7 +25,8 @@ StatusScrollView {
id: root id: root
objectName: "communityEditPanelScrollView" objectName: "communityEditPanelScrollView"
implicitHeight: layout.implicitHeight implicitWidth: contentWidth
implicitHeight: layout.childrenRect.height
property alias name: nameInput.text property alias name: nameInput.text
property alias description: descriptionTextInput.text property alias description: descriptionTextInput.text
@ -53,7 +54,7 @@ StatusScrollView {
id: layout id: layout
width: 608 width: 608
height: childrenRect.height height: parent.height
spacing: 12 spacing: 12
@ -140,6 +141,7 @@ StatusScrollView {
CommunityOptions { CommunityOptions {
id: options id: options
Layout.fillWidth: true
} }
StatusModalDivider { StatusModalDivider {

View File

@ -18,6 +18,7 @@ ColumnLayout {
spacing: 8 spacing: 8
implicitHeight: childrenRect.height
StatusBaseText { StatusBaseText {
text: qsTr("Community color") text: qsTr("Community color")
font.pixelSize: 15 font.pixelSize: 15

View File

@ -29,6 +29,7 @@ ColumnLayout {
} }
} }
implicitHeight: childrenRect.height
spacing: 8 spacing: 8
QtObject { QtObject {

View File

@ -268,6 +268,7 @@ Popup {
StatusScrollView { StatusScrollView {
height: 40 height: 40
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true
ScrollBar.vertical.policy: ScrollBar.AlwaysOff ScrollBar.vertical.policy: ScrollBar.AlwaysOff
RowLayout { RowLayout {