refactor: update ScrollBar policy to use AsNeeded for better usability (#1579)

* refactor: update `ScrollBarType` policy to use
`AsNeeded` for better usability

* add selecting of location settings with Enter

* add handlers to enter push
This commit is contained in:
Cyril Anisimov
2025-08-01 05:56:02 +02:00
committed by GitHub
parent 6cede712f5
commit dbeb7edd7a
13 changed files with 42 additions and 16 deletions

View File

@@ -13,7 +13,7 @@ import "../Controls2"
import "../Controls2/TextTypes"
ListView {
ListViewType {
id: root
width: parent.width

View File

@@ -27,6 +27,5 @@ Flickable {
ScrollBar.vertical: ScrollBarType {
id: scrollBar
policy: fl.height >= fl.contentHeight ? ScrollBar.AlwaysOff : ScrollBar.AlwaysOn
}
}

View File

@@ -7,5 +7,5 @@ import "../Controls2"
ScrollBar {
id: root
policy: parent.height >= parent.contentHeight ? ScrollBar.AlwaysOff : ScrollBar.AlwaysOn
policy: ScrollBar.AsNeeded
}

View File

@@ -101,8 +101,8 @@ PageType {
visible: isLoggingEnabled ? true : false
text: qsTr("Logging enabled")
Keys.onEnterPressed: loggingButton.clicked()
Keys.onReturnPressed: loggingButton.clicked()
Keys.onEnterPressed: this.clicked()
Keys.onReturnPressed: this.clicked()
onClicked: {
PageController.goToPage(PageEnum.PageSettingsLogging)
@@ -147,8 +147,8 @@ PageType {
leftImageColor: ""
rightImageSource: "qrc:/images/controls/chevron-down.svg"
Keys.onEnterPressed: splitTunnelingButton.clicked()
Keys.onReturnPressed: splitTunnelingButton.clicked()
Keys.onEnterPressed: this.clicked()
Keys.onReturnPressed: this.clicked()
onClicked: {
homeSplitTunnelingDrawer.openTriggered()
@@ -276,8 +276,8 @@ PageType {
topPadding: 4
bottomPadding: 3
Keys.onEnterPressed: collapsedButtonChevron.clicked()
Keys.onReturnPressed: collapsedButtonChevron.clicked()
Keys.onEnterPressed: this.clicked()
Keys.onReturnPressed: this.clicked()
onClicked: {
if (drawer.isCollapsedStateActive()) {
@@ -320,6 +320,9 @@ PageType {
rightImageSource: hoverEnabled ? "qrc:/images/controls/chevron-down.svg" : ""
Keys.onEnterPressed: this.clicked()
Keys.onReturnPressed: this.clicked()
onClicked: {
ServersModel.processedIndex = ServersModel.defaultIndex

View File

@@ -158,8 +158,8 @@ PageType {
showQuestionDrawer(headerText, descriptionText, yesButtonText, noButtonText, yesButtonFunction, noButtonFunction)
}
Keys.onEnterPressed: saveButton.clicked()
Keys.onReturnPressed: saveButton.clicked()
Keys.onEnterPressed: this.clicked()
Keys.onReturnPressed: this.clicked()
}
}
}

View File

@@ -71,6 +71,9 @@ PageType {
onClicked: function() {
SettingsController.strictKillSwitchEnabled = false
}
Keys.onEnterPressed: this.clicked()
Keys.onReturnPressed: this.clicked()
}
DividerType {}
@@ -103,6 +106,9 @@ PageType {
showQuestionDrawer(headerText, descriptionText, yesButtonText, noButtonText, yesButtonFunction, noButtonFunction)
}
Keys.onEnterPressed: this.clicked()
Keys.onReturnPressed: this.clicked()
}
DividerType {

View File

@@ -64,7 +64,7 @@ PageType {
displayMarginBeginning: 40
displayMarginEnd: 40
ScrollBar.vertical: ScrollBarType { }
ScrollBar.vertical: ScrollBarType {}
footer: Item {
width: listView.width

View File

@@ -286,8 +286,8 @@ PageType {
moreActionsDrawer.openTriggered()
}
Keys.onReturnPressed: addSiteButtonImage.clicked()
Keys.onEnterPressed: addSiteButtonImage.clicked()
Keys.onReturnPressed: this.clicked()
Keys.onEnterPressed: this.clicked()
}
}

View File

@@ -91,8 +91,8 @@ PageType {
}
}
Keys.onEnterPressed: clicked()
Keys.onReturnPressed: clicked()
Keys.onEnterPressed: this.clicked()
Keys.onReturnPressed: this.clicked()
}
}
}

View File

@@ -234,6 +234,9 @@ PageType {
leftImageSource: imageSource
onClicked: { handler() }
Keys.onEnterPressed: this.clicked()
Keys.onReturnPressed: this.clicked()
}
}

View File

@@ -177,6 +177,9 @@ PageType {
onClicked: {
Qt.openUrlExternally(LanguageModel.getCurrentSiteUrl("starter-guide"))
}
Keys.onEnterPressed: this.clicked()
Keys.onReturnPressed: this.clicked()
}
}
}

View File

@@ -118,6 +118,9 @@ PageType {
containers.containerDefaultPort = ProtocolProps.getPortForInstall(defaultContainerProto)
containers.containerDefaultTransportProto = ProtocolProps.defaultTransportProto(defaultContainerProto)
}
Keys.onEnterPressed: this.clicked()
Keys.onReturnPressed: this.clicked()
}
}
}
@@ -147,6 +150,9 @@ PageType {
onClicked: function() {
isEasySetup = false
}
Keys.onEnterPressed: this.clicked()
Keys.onReturnPressed: this.clicked()
}
BasicButtonType {

View File

@@ -256,6 +256,9 @@ PageType {
onClicked: {
accessTypeSelector.currentIndex = 0
}
Keys.onEnterPressed: this.clicked()
Keys.onReturnPressed: this.clicked()
}
HorizontalRadioButton {
@@ -272,6 +275,9 @@ PageType {
ServersModel.getProcessedServerCredentials())
PageController.showBusyIndicator(false)
}
Keys.onEnterPressed: this.clicked()
Keys.onReturnPressed: this.clicked()
}
}
}