added scroll on page with services list

This commit is contained in:
vladimir.kuznetsov 2024-11-21 14:45:28 +07:00
parent aa871bd1c9
commit 74169ef7b3
3 changed files with 66 additions and 61 deletions

View file

@ -145,6 +145,7 @@ Button {
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
hoverEnabled: true hoverEnabled: true
enabled: root.enabled
onEntered: { onEntered: {
backgroundRect.color = root.hoveredColor backgroundRect.color = root.hoveredColor

View file

@ -16,83 +16,88 @@ PageType {
defaultActiveFocusItem: focusItem defaultActiveFocusItem: focusItem
FlickableType { ColumnLayout {
id: fl id: header
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: parent.bottom anchors.left: parent.left
contentHeight: content.height anchors.right: parent.right
ColumnLayout { spacing: 0
id: content
anchors.top: parent.top Item {
anchors.left: parent.left id: focusItem
anchors.right: parent.right KeyNavigation.tab: backButton
}
spacing: 0 BackButtonType {
id: backButton
Item { Layout.topMargin: 20
id: focusItem
KeyNavigation.tab: backButton
}
BackButtonType {
id: backButton
Layout.topMargin: 20
// KeyNavigation.tab: fileButton.rightButton // KeyNavigation.tab: fileButton.rightButton
} }
HeaderType { HeaderType {
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 8 Layout.topMargin: 8
Layout.rightMargin: 16 Layout.rightMargin: 16
Layout.leftMargin: 16 Layout.leftMargin: 16
Layout.bottomMargin: 32 Layout.bottomMargin: 16
headerText: qsTr("VPN by Amnezia") headerText: qsTr("VPN by Amnezia")
descriptionText: qsTr("Choose a VPN service that suits your needs.") descriptionText: qsTr("Choose a VPN service that suits your needs.")
} }
}
ListView { ListView {
id: containers id: servicesListView
width: parent.width anchors.top: header.bottom
height: containers.contentItem.height anchors.right: parent.right
spacing: 16 anchors.left: parent.left
anchors.bottom: parent.bottom
anchors.topMargin: 16
anchors.bottomMargin: 16
spacing: 16
currentIndex: 1 currentIndex: 1
interactive: false clip: true
model: ApiServicesModel model: ApiServicesModel
delegate: Item { ScrollBar.vertical: ScrollBar {
implicitWidth: containers.width id: scrollBar
implicitHeight: delegateContent.implicitHeight policy: servicesListView.height >= servicesListView.contentHeight ? ScrollBar.AlwaysOff : ScrollBar.AlwaysOn
}
ColumnLayout { Keys.onUpPressed: scrollBar.decrease()
id: delegateContent Keys.onDownPressed: scrollBar.increase()
anchors.top: parent.top delegate: Item {
anchors.left: parent.left implicitWidth: servicesListView.width
anchors.right: parent.right implicitHeight: delegateContent.implicitHeight
CardWithIconsType { ColumnLayout {
id: card id: delegateContent
Layout.fillWidth: true anchors.fill: parent
Layout.rightMargin: 16
Layout.leftMargin: 16
headerText: name CardWithIconsType {
bodyText: cardDescription id: card
footerText: price
rightImageSource: "qrc:/images/controls/chevron-right.svg" Layout.fillWidth: true
Layout.rightMargin: 16
Layout.leftMargin: 16
onClicked: { headerText: name
if (isServiceAvailable) { bodyText: cardDescription
ApiServicesModel.setServiceIndex(index) footerText: price
PageController.goToPage(PageEnum.PageSetupWizardApiServiceInfo)
} rightImageSource: "qrc:/images/controls/chevron-right.svg"
}
enabled: isServiceAvailable
onClicked: {
if (isServiceAvailable) {
ApiServicesModel.setServiceIndex(index)
PageController.goToPage(PageEnum.PageSetupWizardApiServiceInfo)
} }
} }
} }

View file

@ -47,7 +47,6 @@ PageType {
KeyNavigation.tab: textKey.textField KeyNavigation.tab: textKey.textField
} }
HeaderType { HeaderType {
property bool isVisible: SettingsController.getInstallationUuid() !== "" || PageController.isStartPageVisible() property bool isVisible: SettingsController.getInstallationUuid() !== "" || PageController.isStartPageVisible()