Merge pull request #4842 from nextcloud/bugfix/user-status-selector-scrollview

Add a ScrollView to the predefined statuses area of the UserStatusSelector
This commit is contained in:
Matthieu Gallien 2022-09-05 16:28:08 +02:00 committed by GitHub
commit ef77967344
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -17,8 +17,8 @@ import QtQuick.Dialogs 1.3
import QtQuick.Layouts 1.15
import QtQuick.Controls 2.15
import QtQuick.Window 2.15
import com.nextcloud.desktopclient 1.0 as NC
import com.nextcloud.desktopclient 1.0 as NC
import Style 1.0
ColumnLayout {
@ -26,27 +26,10 @@ ColumnLayout {
spacing: Style.standardSpacing * 2
property NC.UserStatusSelectorModel userStatusSelectorModel
Column {
// We use a normal column here because layouts often don't adjust to any custom
// alignments for each other. If Item 2 is below Item 1, Item 2 will always set
// its alignment in relation to Item 1 being in default alignment of vertically
// centered. So when we set Item 2 to align top, even if Item 1 is aligned top,
// Item 2 will align itself as if Item 1 were vertically centered.
//
// Since in this case we want to set everything to align top, we use the Column
// which does this well, have it fill the height of the parent ColumnLayout,
// pushing the bottom button box down.
id: mainContentsLayout
spacing: rootLayout.spacing
Layout.fillWidth: true
Layout.fillHeight: true
Layout.alignment: Qt.AlignTop
ColumnLayout {
id: statusButtonsLayout
width: parent.width
Layout.fillWidth: true
spacing: Style.smallSpacing
Label {
@ -128,7 +111,9 @@ ColumnLayout {
ColumnLayout {
id: userStatusMessageLayout
width: parent.width
Layout.fillWidth: true
Layout.fillHeight: true
spacing: Style.smallSpacing
Label {
@ -257,16 +242,20 @@ ColumnLayout {
}
}
ColumnLayout {
ScrollView {
id: predefinedStatusesScrollView
Layout.fillWidth: true
Layout.fillHeight: true
clip: true
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
ListView {
spacing: 0
Repeater {
model: userStatusSelectorModel.predefinedStatuses
PredefinedStatusButton {
Layout.fillWidth: true
delegate: PredefinedStatusButton {
anchors.left: parent.left
anchors.right: parent.right
leftPadding: 0
emojiWidth: fieldButton.width
internalSpacing: statusFieldLayout.spacing + userStatusMessageTextField.leftPadding
@ -316,9 +305,9 @@ ColumnLayout {
visible: userStatusSelectorModel.errorMessage != ""
text: "<b>Error:</b> " + userStatusSelectorModel.errorMessage
}
}
RowLayout {
id: bottomButtonBox
Layout.fillWidth: true
Layout.alignment: Qt.AlignBottom