replace FlickableType with ListViewType in PageSetupWizardProtocolSettings

This commit is contained in:
Cyril Anisimov
2025-07-26 16:04:11 +02:00
parent f814b875d1
commit 9817ad6daf
@@ -29,77 +29,42 @@ PageType {
] ]
} }
FlickableType { BackButtonType {
anchors.fill: parent id: backButton
contentHeight: content.height
Column {
id: content
anchors.top: parent.top anchors.top: parent.top
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.topMargin: 20
onFocusChanged: {
if (this.activeFocus) {
listView.positionViewAtBeginning()
}
}
}
ListViewType {
id: listView
anchors.top: backButton.bottom
anchors.bottom: parent.bottom
anchors.right: parent.right
anchors.left: parent.left
ListView {
id: processedContainerListView
width: parent.width
height: contentItem.height
currentIndex: -1 currentIndex: -1
clip: true
interactive: false
model: proxyContainersModel model: proxyContainersModel
property bool isFocusable: true delegate: ColumnLayout {
width: listView.width
Keys.onTabPressed: {
FocusController.nextKeyTabItem()
}
Keys.onBacktabPressed: {
FocusController.previousKeyTabItem()
}
Keys.onUpPressed: {
FocusController.nextKeyUpItem()
}
Keys.onDownPressed: {
FocusController.nextKeyDownItem()
}
Keys.onLeftPressed: {
FocusController.nextKeyLeftItem()
}
Keys.onRightPressed: {
FocusController.nextKeyRightItem()
}
delegate: Item {
implicitWidth: processedContainerListView.width
implicitHeight: (delegateContent.implicitHeight > root.height) ? delegateContent.implicitHeight : root.height
property alias port:port
ColumnLayout {
id: delegateContent
anchors.fill: parent
anchors.rightMargin: 16
anchors.leftMargin: 16
BackButtonType {
id: backButton
Layout.topMargin: 20
Layout.rightMargin: -16
Layout.leftMargin: -16
}
BaseHeaderType { BaseHeaderType {
id: header id: header
Layout.fillWidth: true Layout.fillWidth: true
Layout.rightMargin: 16
Layout.leftMargin: 16
headerText: qsTr("Installing %1").arg(name) headerText: qsTr("Installing %1").arg(name)
descriptionText: description descriptionText: description
@@ -109,7 +74,8 @@ PageType {
id: showDetailsButton id: showDetailsButton
Layout.topMargin: 16 Layout.topMargin: 16
Layout.leftMargin: -8 Layout.rightMargin: 16
Layout.leftMargin: 16
implicitHeight: 32 implicitHeight: 32
@@ -120,7 +86,6 @@ PageType {
textColor: AmneziaStyle.color.goldenApricot textColor: AmneziaStyle.color.goldenApricot
text: qsTr("More detailed") text: qsTr("More detailed")
KeyNavigation.tab: transportProtoSelector
clickedFunc: function() { clickedFunc: function() {
showDetailsDrawer.openTriggered() showDetailsDrawer.openTriggered()
@@ -149,39 +114,40 @@ PageType {
} }
} }
FlickableType { ListViewType {
id: fl id: showDetailsListView
anchors.top: showDetailsBackButton.bottom anchors.top: showDetailsBackButton.bottom
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
contentHeight: {
var emptySpaceHeight = parent.height - showDetailsBackButton.implicitHeight - showDetailsBackButton.anchors.topMargin
return (showDetailsDrawerContent.height > emptySpaceHeight) ?
showDetailsDrawerContent.height : emptySpaceHeight
}
ColumnLayout { header: ColumnLayout {
id: showDetailsDrawerContent width: showDetailsListView.width
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.rightMargin: 16
anchors.leftMargin: 16
Header2Type { Header2Type {
id: showDetailsDrawerHeader id: showDetailsDrawerHeader
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 16 Layout.topMargin: 16
Layout.rightMargin: 16
Layout.leftMargin: 16
headerText: name headerText: name
} }
}
model: 1 // fake model to force the ListView to be created without a model
delegate: ColumnLayout {
width: showDetailsListView.width
ParagraphTextType { ParagraphTextType {
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 16 Layout.topMargin: 16
Layout.bottomMargin: 16 Layout.bottomMargin: 16
Layout.leftMargin: 16
Layout.rightMargin: 16
text: detailedDescription text: detailedDescription
textFormat: Text.MarkdownText textFormat: Text.MarkdownText
@@ -189,14 +155,22 @@ PageType {
Rectangle { Rectangle {
Layout.fillHeight: true Layout.fillHeight: true
Layout.leftMargin: 16
Layout.rightMargin: 16
color: AmneziaStyle.color.transparent color: AmneziaStyle.color.transparent
} }
}
footer: ColumnLayout {
width: showDetailsListView.width
BasicButtonType { BasicButtonType {
id: showDetailsCloseButton id: showDetailsCloseButton
Layout.fillWidth: true Layout.fillWidth: true
Layout.bottomMargin: 32 Layout.bottomMargin: 32
parentFlickable: fl Layout.leftMargin: 16
Layout.rightMargin: 16
text: qsTr("Close") text: qsTr("Close")
@@ -213,6 +187,8 @@ PageType {
id: transportProtoHeader id: transportProtoHeader
Layout.topMargin: 16 Layout.topMargin: 16
Layout.rightMargin: 16
Layout.leftMargin: 16
text: qsTr("Network protocol") text: qsTr("Network protocol")
} }
@@ -221,6 +197,9 @@ PageType {
id: transportProtoSelector id: transportProtoSelector
Layout.fillWidth: true Layout.fillWidth: true
Layout.rightMargin: 16
Layout.leftMargin: 16
rootWidth: root.width rootWidth: root.width
} }
@@ -229,6 +208,8 @@ PageType {
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 16 Layout.topMargin: 16
Layout.rightMargin: 16
Layout.leftMargin: 16
headerText: qsTr("Port") headerText: qsTr("Port")
textField.maximumLength: 5 textField.maximumLength: 5
@@ -237,6 +218,9 @@ PageType {
Rectangle { Rectangle {
Layout.fillHeight: true Layout.fillHeight: true
Layout.rightMargin: 16
Layout.leftMargin: 16
color: AmneziaStyle.color.transparent color: AmneziaStyle.color.transparent
} }
@@ -245,6 +229,8 @@ PageType {
Layout.fillWidth: true Layout.fillWidth: true
Layout.bottomMargin: 32 Layout.bottomMargin: 32
Layout.rightMargin: 16
Layout.leftMargin: 16
text: qsTr("Install") text: qsTr("Install")
@@ -279,6 +265,3 @@ PageType {
} }
} }
} }
}
}
}