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
hoverEnabled: true
enabled: root.enabled
onEntered: {
backgroundRect.color = root.hoveredColor

View file

@ -16,14 +16,8 @@ PageType {
defaultActiveFocusItem: focusItem
FlickableType {
id: fl
anchors.top: parent.top
anchors.bottom: parent.bottom
contentHeight: content.height
ColumnLayout {
id: content
id: header
anchors.top: parent.top
anchors.left: parent.left
@ -47,32 +41,43 @@ PageType {
Layout.topMargin: 8
Layout.rightMargin: 16
Layout.leftMargin: 16
Layout.bottomMargin: 32
Layout.bottomMargin: 16
headerText: qsTr("VPN by Amnezia")
descriptionText: qsTr("Choose a VPN service that suits your needs.")
}
}
ListView {
id: containers
width: parent.width
height: containers.contentItem.height
id: servicesListView
anchors.top: header.bottom
anchors.right: parent.right
anchors.left: parent.left
anchors.bottom: parent.bottom
anchors.topMargin: 16
anchors.bottomMargin: 16
spacing: 16
currentIndex: 1
interactive: false
clip: true
model: ApiServicesModel
ScrollBar.vertical: ScrollBar {
id: scrollBar
policy: servicesListView.height >= servicesListView.contentHeight ? ScrollBar.AlwaysOff : ScrollBar.AlwaysOn
}
Keys.onUpPressed: scrollBar.decrease()
Keys.onDownPressed: scrollBar.increase()
delegate: Item {
implicitWidth: containers.width
implicitWidth: servicesListView.width
implicitHeight: delegateContent.implicitHeight
ColumnLayout {
id: delegateContent
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.fill: parent
CardWithIconsType {
id: card
@ -87,6 +92,8 @@ PageType {
rightImageSource: "qrc:/images/controls/chevron-right.svg"
enabled: isServiceAvailable
onClicked: {
if (isServiceAvailable) {
ApiServicesModel.setServiceIndex(index)
@ -97,6 +104,4 @@ PageType {
}
}
}
}
}
}

View file

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