quicksettings: fix landscape not being scrollable

Currently, Quick Settings in landscape mode is not scrollable, due to issues with `scrollViewComponent`. This causes some buttons to become unseen in landscape mode but not portrait. This has been solved by deleting `scrollViewComponent` and replacing it with `swipeViewComponent`, to allow swiping to access other buttons in Quick Settings.

Before (docked mode and hotspot are missing):

![screen-recording__1_](/uploads/e0c4eaf22a2ec401c66e9e513e8ce7e1/screen-recording__1_.webm)

After (docked mode and hotspot are there):

![screen-recording](/uploads/404ebbecc87e1b60b2501b81b8ab83ee/screen-recording.webm)

However, with this setup, `resetSwipeView()` doesn't work, and Quick Settings remains at the page it was left at.
This commit is contained in:
User8395 2024-10-25 17:02:30 +00:00 committed by Devin Lin
parent 681d1683f5
commit 889c085c21

View file

@ -103,7 +103,7 @@ Item {
Layout.minimumHeight: rowCount * rowHeight Layout.minimumHeight: rowCount * rowHeight
asynchronous: true asynchronous: true
sourceComponent: root.mode === QuickSettings.Pages ? swipeViewComponent : scrollViewComponent sourceComponent: swipeViewComponent
} }
BrightnessItem { BrightnessItem {
@ -157,7 +157,7 @@ Item {
} }
} }
// Loads portrait quick settings view // Loads portrait and landscape quick settings view
Component { Component {
id: swipeViewComponent id: swipeViewComponent
@ -228,64 +228,6 @@ Item {
} }
} }
// Loads landscape quick settings view
Component {
id: scrollViewComponent
Item {
width: parent.width
height: rowCount * rowHeight
Flickable {
id: flickable
anchors.fill: parent
contentWidth: width
contentHeight: flow.height
clip: true
ScrollIndicator.vertical: ScrollIndicator {
id: scrollIndicator
visible: quickSettingsCount > pageSize ? true : false
position: 0.1
contentItem: Item {
implicitWidth: Kirigami.Units.smallSpacing / 4
Rectangle {
// shift over the indicator a bit to the right
anchors.fill: parent
anchors.leftMargin: 2
anchors.rightMargin: -2
color: Kirigami.Theme.textColor
opacity: scrollIndicator.active ? 0.5 : 0
Behavior on opacity { NumberAnimation {} }
}
}
}
Flow {
id: flow
width: parent.width
height: Math.ceil(quickSettingsCount / columnCount) * rowHeight
spacing: 0
Repeater {
model: quickSettingsModel
delegate: Loader {
required property var modelData
asynchronous: true
sourceComponent: quickSettingComponent
}
}
}
}
}
}
// Quick setting component // Quick setting component
Component { Component {
id: quickSettingComponent id: quickSettingComponent