Skip to content

Commit

Permalink
feat: wallpaper module optimization
Browse files Browse the repository at this point in the history
- 异步加载图片
- 居中布局

pms: TASK-368711
  • Loading branch information
mhduiy committed Dec 10, 2024
1 parent 336c342 commit bedf853
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions src/plugin-personalization/qml/WallpaperSelectView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,26 @@ ColumnLayout {
}
}

Flow {
id: layout
property int lineCount: Math.floor((parent.width + imageSpacing) / (imageRectW + imageSpacing))
width: lineCount * (imageRectW + imageSpacing) - imageSpacing
spacing: imageSpacing
bottomPadding: imageSpacing
anchors.horizontalCenter: parent.horizontalCenter

move: Transition {
}

Repeater {
model: sortedModel
}
}

D.SortFilterModel {
id: sortedModel
model: root.model
property int maxCount: Math.floor((layout.width + imageSpacing) / (imageRectW + imageSpacing)) * 2
property int maxCount: layout.lineCount * 2
lessThan: function(left, right) {
return left.index < right.index
}
Expand Down Expand Up @@ -104,6 +120,7 @@ ColumnLayout {
height: 2 / Screen.devicePixelRatio
source: model.url
fillMode: Image.Stretch
asynchronous: true
}

Image {
Expand Down Expand Up @@ -200,18 +217,5 @@ ColumnLayout {
}
}
}
Flow {
id: layout
width: parent.width
spacing: imageSpacing
bottomPadding: imageSpacing

move: Transition {
}

Repeater {
model: sortedModel
}
}
}
}

0 comments on commit bedf853

Please sign in to comment.