fix(StatusDialogFooter): Prevent footer's buttons overflow

This commit is contained in:
Michał Cieślak 2024-02-08 17:59:53 +01:00 committed by Michał
parent 480985ca4e
commit 6aee04e33e
8 changed files with 130 additions and 19 deletions

View File

@ -0,0 +1,89 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import QtQml.Models 2.15
import Storybook 1.0
import StatusQ.Controls 0.1
import StatusQ.Popups.Dialog 0.1
SplitView {
id: root
orientation: Qt.Vertical
Item {
SplitView.fillWidth: true
SplitView.fillHeight: true
Rectangle {
border.color: "lightgray"
anchors.fill: footer
anchors.margins: -5
}
StatusDialogFooter {
id: footer
anchors.centerIn: parent
width: widthNotSpecifiedCheckBox.checked
? undefined
: Math.floor(root.width * slider.value)
rightButtons: ObjectModel {
StatusButton {
id: rejectBtn
text: qsTr("I I don't want to be the owner")
}
StatusButton {
id: acceptBtn
text: qsTr("Finalize owhership")
}
}
leftButtons: ObjectModel {
StatusBackButton {
id: backButton
Layout.minimumWidth: implicitWidth
}
}
}
}
LogsAndControlsPanel {
SplitView.minimumHeight: 100
SplitView.preferredHeight: 200
SplitView.fillWidth: true
ColumnLayout {
Label {
text: `Footer width: ${footer.width}`
}
Label {
text: `Footer implicitWidth: ${footer.implicitWidth}`
}
Slider {
id: slider
enabled: !widthNotSpecifiedCheckBox.checked
from: 0.2
to: 1
value: 0.5
}
CheckBox {
id: widthNotSpecifiedCheckBox
text: "width not specified"
}
}
}
}
// category: Components

View File

@ -1,6 +1,6 @@
import QtQuick 2.14 import QtQuick 2.15
import QtQuick.Layouts 1.14 import QtQuick.Layouts 1.15
import QtQml.Models 2.14 import QtQml.Models 2.15
import StatusQ.Core 0.1 import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1 import StatusQ.Core.Theme 0.1
@ -31,7 +31,10 @@ Rectangle {
Repeater { Repeater {
model: root.leftButtons model: root.leftButtons
onItemAdded: item.Layout.fillHeight = true onItemAdded: {
item.Layout.fillHeight = true
item.Layout.fillWidth = Qt.binding(() => root.width < root.implicitWidth)
}
} }
Item { Item {
@ -40,7 +43,10 @@ Rectangle {
Repeater { Repeater {
model: root.rightButtons model: root.rightButtons
onItemAdded: item.Layout.fillHeight = true onItemAdded: {
item.Layout.fillHeight = true
item.Layout.fillWidth = Qt.binding(() => root.width < root.implicitWidth)
}
} }
} }

View File

@ -1,5 +1,6 @@
import QtQuick 2.12 import QtQuick 2.15
import QtQuick.Controls 2.12 import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import StatusQ.Controls 0.1 import StatusQ.Controls 0.1
import StatusQ.Popups 0.1 import StatusQ.Popups 0.1
@ -79,6 +80,8 @@ StatusModal {
onClicked: { onClicked: {
contentItem.pop() contentItem.pop()
} }
Layout.minimumWidth: implicitWidth
} }
] ]
} }

View File

@ -286,6 +286,8 @@ StatusStackModal {
d.currentPage = (d.currentPage === CreateChannelPopup.CurrentPage.DiscordImportUploadStart) ? d.currentPage = (d.currentPage === CreateChannelPopup.CurrentPage.DiscordImportUploadStart) ?
CreateChannelPopup.CurrentPage.DiscordImportUploadFile : CreateChannelPopup.CurrentPage.ChannelDetails CreateChannelPopup.CurrentPage.DiscordImportUploadFile : CreateChannelPopup.CurrentPage.ChannelDetails
} }
Layout.minimumWidth: implicitWidth
} }

View File

@ -132,6 +132,7 @@ StatusDialog {
footer: StatusDialogFooter { footer: StatusDialogFooter {
spacing: Style.current.padding spacing: Style.current.padding
rightButtons: ObjectModel { rightButtons: ObjectModel {
StatusFlatButton { StatusFlatButton {
id: rejectBtn id: rejectBtn
@ -149,7 +150,11 @@ StatusDialog {
} }
} }
leftButtons: ObjectModel { leftButtons: ObjectModel {
StatusBackButton { id: backButton } StatusBackButton {
id: backButton
Layout.minimumWidth: implicitWidth
}
} }
} }

View File

@ -1,5 +1,6 @@
import QtQuick 2.14 import QtQuick 2.15
import QtQuick.Controls 2.14 import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import StatusQ.Core 0.1 import StatusQ.Core 0.1
import StatusQ.Popups 0.1 import StatusQ.Popups 0.1
@ -201,8 +202,9 @@ StatusModal {
objectName: "AddAccountPopup-BackButton" objectName: "AddAccountPopup-BackButton"
visible: root.store.currentState.displayBackButton visible: root.store.currentState.displayBackButton
enabled: !root.store.disablePopup enabled: !root.store.disablePopup
height: Constants.addAccountPopup.footerButtonsHeight
width: height Layout.minimumWidth: implicitWidth
onClicked: { onClicked: {
if (root.store.currentState.stateType === Constants.addAccountPopup.state.confirmAddingNewMasterKey) { if (root.store.currentState.stateType === Constants.addAccountPopup.state.confirmAddingNewMasterKey) {
root.store.addingNewMasterKeyConfirmed = false root.store.addingNewMasterKeyConfirmed = false

View File

@ -1,4 +1,5 @@
import QtQuick 2.14 import QtQuick 2.15
import QtQuick.Layouts 1.15
import StatusQ.Controls 0.1 import StatusQ.Controls 0.1
import StatusQ.Core.Theme 0.1 import StatusQ.Core.Theme 0.1
@ -58,8 +59,9 @@ QtObject {
id: backButton id: backButton
visible: root.sharedKeycardModule.currentState.displayBackButton visible: root.sharedKeycardModule.currentState.displayBackButton
enabled: !root.disableActionPopupButtons enabled: !root.disableActionPopupButtons
height: Constants.keycard.general.footerButtonsHeight
width: height Layout.minimumWidth: implicitWidth
onClicked: { onClicked: {
root.sharedKeycardModule.currentState.doBackAction() root.sharedKeycardModule.currentState.doBackAction()
} }

View File

@ -1,5 +1,6 @@
import QtQuick 2.14 import QtQuick 2.15
import QtQuick.Controls 2.14 import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import StatusQ.Core 0.1 import StatusQ.Core 0.1
import StatusQ.Popups 0.1 import StatusQ.Popups 0.1
@ -150,8 +151,9 @@ StatusModal {
StatusBackButton { StatusBackButton {
id: backButton id: backButton
visible: root.store.currentState.displayBackButton visible: root.store.currentState.displayBackButton
height: Constants.keypairImportPopup.footerButtonsHeight
width: height Layout.minimumWidth: implicitWidth
onClicked: { onClicked: {
root.store.currentState.doBackAction() root.store.currentState.doBackAction()
} }