mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
homescreens/halcyon: Improve gridview scrolling performance
This commit is contained in:
parent
5fa405c63d
commit
0a4c669e8a
2 changed files with 7 additions and 5 deletions
|
|
@ -127,8 +127,7 @@ MouseArea {
|
||||||
}
|
}
|
||||||
spacing: 0
|
spacing: 0
|
||||||
|
|
||||||
// Use Kirigami.Icon to have better icon dimension options
|
PlasmaCore.IconItem {
|
||||||
Kirigami.Icon {
|
|
||||||
id: icon
|
id: icon
|
||||||
|
|
||||||
Kirigami.Theme.inherit: false
|
Kirigami.Theme.inherit: false
|
||||||
|
|
|
||||||
|
|
@ -19,16 +19,19 @@ import org.kde.phone.homescreen.halcyon 1.0 as Halcyon
|
||||||
|
|
||||||
MobileShell.GridView {
|
MobileShell.GridView {
|
||||||
id: gridView
|
id: gridView
|
||||||
layer.enabled: true
|
cacheBuffer: cellHeight * 20 // 10 rows above and below
|
||||||
reuseItems: true
|
reuseItems: true
|
||||||
|
|
||||||
|
// ensure items aren't visible out of bounds
|
||||||
|
layer.enabled: true
|
||||||
|
|
||||||
readonly property int reservedSpaceForLabel: metrics.height
|
readonly property int reservedSpaceForLabel: metrics.height
|
||||||
readonly property real effectiveContentWidth: width - leftMargin - rightMargin
|
readonly property real effectiveContentWidth: width - leftMargin - rightMargin
|
||||||
|
|
||||||
cellWidth: gridView.effectiveContentWidth / Math.min(Math.floor(gridView.effectiveContentWidth / (PlasmaCore.Units.iconSizes.huge + Kirigami.Units.largeSpacing * 2)), 8)
|
cellWidth: gridView.effectiveContentWidth / Math.min(Math.floor(effectiveContentWidth / (PlasmaCore.Units.iconSizes.huge + Kirigami.Units.largeSpacing * 2)), 8)
|
||||||
cellHeight: cellWidth + reservedSpaceForLabel
|
cellHeight: cellWidth + reservedSpaceForLabel
|
||||||
|
|
||||||
property int columns: Math.floor(gridView.effectiveContentWidth / cellWidth)
|
property int columns: Math.floor(effectiveContentWidth / cellWidth)
|
||||||
property int rows: Math.ceil(Halcyon.ApplicationListModel.count / columns)
|
property int rows: Math.ceil(Halcyon.ApplicationListModel.count / columns)
|
||||||
|
|
||||||
function goToBeginning() {
|
function goToBeginning() {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue