controlcenter: fonts performance fix (virtual listview)
This commit is contained in:
parent
420a19bf31
commit
7d839be3e5
1 changed files with 313 additions and 311 deletions
|
|
@ -540,17 +540,19 @@ RowLayout {
|
|||
font.weight: 500
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
StyledListView {
|
||||
Layout.fillWidth: true
|
||||
spacing: Appearance.spacing.small / 2
|
||||
Layout.preferredHeight: Math.min(contentHeight, 300)
|
||||
|
||||
Repeater {
|
||||
clip: true
|
||||
spacing: Appearance.spacing.small / 2
|
||||
model: Qt.fontFamilies()
|
||||
|
||||
delegate: StyledRect {
|
||||
required property string modelData
|
||||
required property int index
|
||||
|
||||
Layout.fillWidth: true
|
||||
width: ListView.view.width
|
||||
|
||||
readonly property bool isCurrent: modelData === rootPane.fontFamilyMaterial
|
||||
color: Qt.alpha(Colours.tPalette.m3surfaceContainer, isCurrent ? Colours.tPalette.m3surfaceContainer.a : 0)
|
||||
|
|
@ -599,7 +601,6 @@ RowLayout {
|
|||
implicitHeight: fontFamilyMaterialRow.implicitHeight + Appearance.padding.normal * 2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
StyledText {
|
||||
Layout.topMargin: Appearance.spacing.normal
|
||||
|
|
@ -608,17 +609,19 @@ RowLayout {
|
|||
font.weight: 500
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
StyledListView {
|
||||
Layout.fillWidth: true
|
||||
spacing: Appearance.spacing.small / 2
|
||||
Layout.preferredHeight: Math.min(contentHeight, 300)
|
||||
|
||||
Repeater {
|
||||
clip: true
|
||||
spacing: Appearance.spacing.small / 2
|
||||
model: Qt.fontFamilies()
|
||||
|
||||
delegate: StyledRect {
|
||||
required property string modelData
|
||||
required property int index
|
||||
|
||||
Layout.fillWidth: true
|
||||
width: ListView.view.width
|
||||
|
||||
readonly property bool isCurrent: modelData === rootPane.fontFamilyMono
|
||||
color: Qt.alpha(Colours.tPalette.m3surfaceContainer, isCurrent ? Colours.tPalette.m3surfaceContainer.a : 0)
|
||||
|
|
@ -667,7 +670,6 @@ RowLayout {
|
|||
implicitHeight: fontFamilyMonoRow.implicitHeight + Appearance.padding.normal * 2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
StyledText {
|
||||
Layout.topMargin: Appearance.spacing.normal
|
||||
|
|
@ -676,17 +678,19 @@ RowLayout {
|
|||
font.weight: 500
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
StyledListView {
|
||||
Layout.fillWidth: true
|
||||
spacing: Appearance.spacing.small / 2
|
||||
Layout.preferredHeight: Math.min(contentHeight, 300)
|
||||
|
||||
Repeater {
|
||||
clip: true
|
||||
spacing: Appearance.spacing.small / 2
|
||||
model: Qt.fontFamilies()
|
||||
|
||||
delegate: StyledRect {
|
||||
required property string modelData
|
||||
required property int index
|
||||
|
||||
Layout.fillWidth: true
|
||||
width: ListView.view.width
|
||||
|
||||
readonly property bool isCurrent: modelData === rootPane.fontFamilySans
|
||||
color: Qt.alpha(Colours.tPalette.m3surfaceContainer, isCurrent ? Colours.tPalette.m3surfaceContainer.a : 0)
|
||||
|
|
@ -735,7 +739,6 @@ RowLayout {
|
|||
implicitHeight: fontFamilySansRow.implicitHeight + Appearance.padding.normal * 2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SectionContainer {
|
||||
contentSpacing: Appearance.spacing.normal
|
||||
|
|
@ -1874,35 +1877,35 @@ RowLayout {
|
|||
color: Colours.palette.m3onSurfaceVariant
|
||||
}
|
||||
|
||||
GridLayout {
|
||||
GridView {
|
||||
id: wallpaperGrid
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: Appearance.spacing.large
|
||||
Layout.preferredHeight: Math.min(600, Math.ceil(count / Math.floor(width / cellWidth)) * cellHeight)
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
|
||||
columns: Math.max(2, Math.floor(parent.width / 200))
|
||||
rowSpacing: Appearance.spacing.normal
|
||||
columnSpacing: Appearance.spacing.normal
|
||||
cellWidth: 200 + Appearance.spacing.normal
|
||||
cellHeight: 140 + Appearance.spacing.normal
|
||||
|
||||
// Center the grid content
|
||||
Layout.maximumWidth: {
|
||||
const cols = columns;
|
||||
const itemWidth = 200;
|
||||
const spacing = columnSpacing;
|
||||
return cols * itemWidth + (cols - 1) * spacing;
|
||||
}
|
||||
|
||||
Repeater {
|
||||
model: Wallpapers.list
|
||||
clip: true
|
||||
|
||||
// Enable caching for better performance
|
||||
cacheBuffer: cellHeight * 2
|
||||
|
||||
StyledScrollBar.vertical: StyledScrollBar {
|
||||
flickable: wallpaperGrid
|
||||
}
|
||||
|
||||
delegate: Item {
|
||||
required property var modelData
|
||||
|
||||
Layout.preferredWidth: 200
|
||||
Layout.preferredHeight: 140
|
||||
Layout.minimumWidth: 200
|
||||
Layout.minimumHeight: 140
|
||||
Layout.maximumWidth: 200
|
||||
Layout.maximumHeight: 140
|
||||
width: 200
|
||||
height: 140
|
||||
|
||||
// Center in cell
|
||||
x: (wallpaperGrid.cellWidth - width) / 2
|
||||
y: (wallpaperGrid.cellHeight - height) / 2
|
||||
|
||||
readonly property bool isCurrent: modelData.path === Wallpapers.actualCurrent
|
||||
|
||||
|
|
@ -2086,4 +2089,3 @@ RowLayout {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue