mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
quicksettings: fix landscape view
This commit is contained in:
parent
ee951627b3
commit
ed0030eea3
2 changed files with 65 additions and 38 deletions
|
|
@ -11,6 +11,7 @@ import QtQuick.Layouts 1.1
|
|||
import QtQuick.Window 2.2
|
||||
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 3.0 as PlasmaComponents
|
||||
import org.kde.plasma.private.mobileshell 1.0 as MobileShell
|
||||
|
||||
import "../../components" as Components
|
||||
|
|
@ -42,8 +43,7 @@ Item {
|
|||
|
||||
readonly property MobileShell.QuickSettingsModel quickSettingsModel: MobileShell.QuickSettingsModel {}
|
||||
|
||||
readonly property real pageHeight: (Window.height * 60/100)
|
||||
readonly property int rowCount: Math.floor(pageHeight / rowHeight)
|
||||
readonly property int rowCount: Math.floor(Window.height * 65/100 / rowHeight)
|
||||
readonly property int columnCount: Math.floor(width/columnWidth)
|
||||
readonly property int pageSize: rowCount * columnCount
|
||||
readonly property int quickSettingsCount: quickSettingsModel.count
|
||||
|
|
@ -82,6 +82,7 @@ Item {
|
|||
id: pageLoader
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.minimumHeight: rowCount * rowHeight
|
||||
|
||||
asynchronous: true
|
||||
sourceComponent: MobileShell.Shell.orientation === MobileShell.Shell.Portrait ? swipeViewComponent : scrollViewComponent
|
||||
|
|
@ -139,7 +140,7 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
// Loaded when in portrait mode
|
||||
// Loads portrait quick settings view
|
||||
Component {
|
||||
id: swipeViewComponent
|
||||
|
||||
|
|
@ -210,32 +211,64 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
// Loaded when in landscape mode
|
||||
// Loads landscape quick settings view
|
||||
Component {
|
||||
id: scrollViewComponent
|
||||
|
||||
Flickable {
|
||||
clip: true
|
||||
height: pageHeight
|
||||
Item {
|
||||
width: parent.width
|
||||
height: rowCount * rowHeight
|
||||
|
||||
contentWidth: parent.width
|
||||
contentHeight: quickSettingsCount / columnCount * rowHeight
|
||||
PlasmaComponents.ScrollView {
|
||||
enabled: pageSize <= quickSettingsCount
|
||||
|
||||
Flow {
|
||||
width: parent.width
|
||||
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
||||
ScrollBar.vertical.policy: ScrollBar.AlwaysOff
|
||||
ScrollBar.vertical.interactive:false
|
||||
|
||||
height: quickSettingsCount / columnCount * rowHeight
|
||||
anchors.fill: parent
|
||||
contentWidth: width
|
||||
contentHeight: height
|
||||
contentItem: flickable
|
||||
}
|
||||
|
||||
spacing: 0
|
||||
Flickable {
|
||||
id: flickable
|
||||
anchors.fill: parent
|
||||
contentWidth: width
|
||||
contentHeight: flow.height
|
||||
|
||||
Repeater {
|
||||
model: quickSettingsModel
|
||||
delegate: Loader {
|
||||
required property var modelData
|
||||
clip: true
|
||||
|
||||
asynchronous: true
|
||||
ScrollIndicator.vertical: ScrollIndicator {
|
||||
active: true
|
||||
|
||||
sourceComponent: quickSettingComponent
|
||||
visible: quickSettingsCount > pageSize ? true : false
|
||||
|
||||
position: 0.1
|
||||
|
||||
contentItem: Rectangle {
|
||||
implicitWidth: PlasmaCore.Units.smallSpacing/4
|
||||
color: PlasmaCore.Theme.textColor
|
||||
opacity: 0.5
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ import QtGraphicalEffects 1.12
|
|||
import org.kde.kirigami 2.12 as Kirigami
|
||||
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 3.0 as PlasmaComponents
|
||||
import org.kde.plasma.private.mobileshell 1.0 as MobileShell
|
||||
|
||||
import "../../statusbar" as StatusBar
|
||||
|
|
@ -82,25 +81,20 @@ Components.BaseItem {
|
|||
disableSystemTray: actionDrawer.restrictedPermissions
|
||||
}
|
||||
|
||||
PlasmaComponents.ScrollView {
|
||||
id: scrollView
|
||||
QuickSettings {
|
||||
id: quickSettings
|
||||
|
||||
width: column.width
|
||||
implicitHeight: quickSettings.fullHeight
|
||||
|
||||
Layout.alignment: Qt.AlignTop
|
||||
Layout.fillWidth: true
|
||||
Layout.maximumHeight: root.fullHeight - root.topPadding - root.bottomPadding - statusBar.height - mediaWidget.fullHeight - PlasmaCore.Units.smallSpacing
|
||||
Layout.maximumWidth: column.width
|
||||
|
||||
QQC2.ScrollBar.horizontal.policy: QQC2.ScrollBar.AlwaysOff
|
||||
clip: true
|
||||
|
||||
QuickSettings {
|
||||
id: quickSettings
|
||||
width: column.width
|
||||
implicitHeight: quickSettings.fullHeight
|
||||
|
||||
actionDrawer: root.actionDrawer
|
||||
minimizedViewProgress: 0
|
||||
fullViewProgress: 1
|
||||
}
|
||||
actionDrawer: root.actionDrawer
|
||||
minimizedViewProgress: 0
|
||||
fullViewProgress: 1
|
||||
}
|
||||
|
||||
Item { Layout.fillHeight: true }
|
||||
|
|
|
|||
Loading…
Reference in a new issue