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
|
font.weight: 500
|
||||||
}
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
StyledListView {
|
||||||
Layout.fillWidth: true
|
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()
|
model: Qt.fontFamilies()
|
||||||
|
|
||||||
delegate: StyledRect {
|
delegate: StyledRect {
|
||||||
required property string modelData
|
required property string modelData
|
||||||
|
required property int index
|
||||||
|
|
||||||
Layout.fillWidth: true
|
width: ListView.view.width
|
||||||
|
|
||||||
readonly property bool isCurrent: modelData === rootPane.fontFamilyMaterial
|
readonly property bool isCurrent: modelData === rootPane.fontFamilyMaterial
|
||||||
color: Qt.alpha(Colours.tPalette.m3surfaceContainer, isCurrent ? Colours.tPalette.m3surfaceContainer.a : 0)
|
color: Qt.alpha(Colours.tPalette.m3surfaceContainer, isCurrent ? Colours.tPalette.m3surfaceContainer.a : 0)
|
||||||
|
|
@ -599,7 +601,6 @@ RowLayout {
|
||||||
implicitHeight: fontFamilyMaterialRow.implicitHeight + Appearance.padding.normal * 2
|
implicitHeight: fontFamilyMaterialRow.implicitHeight + Appearance.padding.normal * 2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
Layout.topMargin: Appearance.spacing.normal
|
Layout.topMargin: Appearance.spacing.normal
|
||||||
|
|
@ -608,17 +609,19 @@ RowLayout {
|
||||||
font.weight: 500
|
font.weight: 500
|
||||||
}
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
StyledListView {
|
||||||
Layout.fillWidth: true
|
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()
|
model: Qt.fontFamilies()
|
||||||
|
|
||||||
delegate: StyledRect {
|
delegate: StyledRect {
|
||||||
required property string modelData
|
required property string modelData
|
||||||
|
required property int index
|
||||||
|
|
||||||
Layout.fillWidth: true
|
width: ListView.view.width
|
||||||
|
|
||||||
readonly property bool isCurrent: modelData === rootPane.fontFamilyMono
|
readonly property bool isCurrent: modelData === rootPane.fontFamilyMono
|
||||||
color: Qt.alpha(Colours.tPalette.m3surfaceContainer, isCurrent ? Colours.tPalette.m3surfaceContainer.a : 0)
|
color: Qt.alpha(Colours.tPalette.m3surfaceContainer, isCurrent ? Colours.tPalette.m3surfaceContainer.a : 0)
|
||||||
|
|
@ -667,7 +670,6 @@ RowLayout {
|
||||||
implicitHeight: fontFamilyMonoRow.implicitHeight + Appearance.padding.normal * 2
|
implicitHeight: fontFamilyMonoRow.implicitHeight + Appearance.padding.normal * 2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
Layout.topMargin: Appearance.spacing.normal
|
Layout.topMargin: Appearance.spacing.normal
|
||||||
|
|
@ -676,17 +678,19 @@ RowLayout {
|
||||||
font.weight: 500
|
font.weight: 500
|
||||||
}
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
StyledListView {
|
||||||
Layout.fillWidth: true
|
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()
|
model: Qt.fontFamilies()
|
||||||
|
|
||||||
delegate: StyledRect {
|
delegate: StyledRect {
|
||||||
required property string modelData
|
required property string modelData
|
||||||
|
required property int index
|
||||||
|
|
||||||
Layout.fillWidth: true
|
width: ListView.view.width
|
||||||
|
|
||||||
readonly property bool isCurrent: modelData === rootPane.fontFamilySans
|
readonly property bool isCurrent: modelData === rootPane.fontFamilySans
|
||||||
color: Qt.alpha(Colours.tPalette.m3surfaceContainer, isCurrent ? Colours.tPalette.m3surfaceContainer.a : 0)
|
color: Qt.alpha(Colours.tPalette.m3surfaceContainer, isCurrent ? Colours.tPalette.m3surfaceContainer.a : 0)
|
||||||
|
|
@ -735,7 +739,6 @@ RowLayout {
|
||||||
implicitHeight: fontFamilySansRow.implicitHeight + Appearance.padding.normal * 2
|
implicitHeight: fontFamilySansRow.implicitHeight + Appearance.padding.normal * 2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
SectionContainer {
|
SectionContainer {
|
||||||
contentSpacing: Appearance.spacing.normal
|
contentSpacing: Appearance.spacing.normal
|
||||||
|
|
@ -1874,35 +1877,35 @@ RowLayout {
|
||||||
color: Colours.palette.m3onSurfaceVariant
|
color: Colours.palette.m3onSurfaceVariant
|
||||||
}
|
}
|
||||||
|
|
||||||
GridLayout {
|
GridView {
|
||||||
|
id: wallpaperGrid
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: Appearance.spacing.large
|
Layout.topMargin: Appearance.spacing.large
|
||||||
|
Layout.preferredHeight: Math.min(600, Math.ceil(count / Math.floor(width / cellWidth)) * cellHeight)
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
|
|
||||||
columns: Math.max(2, Math.floor(parent.width / 200))
|
cellWidth: 200 + Appearance.spacing.normal
|
||||||
rowSpacing: Appearance.spacing.normal
|
cellHeight: 140 + Appearance.spacing.normal
|
||||||
columnSpacing: 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
|
model: Wallpapers.list
|
||||||
|
clip: true
|
||||||
|
|
||||||
|
// Enable caching for better performance
|
||||||
|
cacheBuffer: cellHeight * 2
|
||||||
|
|
||||||
|
StyledScrollBar.vertical: StyledScrollBar {
|
||||||
|
flickable: wallpaperGrid
|
||||||
|
}
|
||||||
|
|
||||||
delegate: Item {
|
delegate: Item {
|
||||||
required property var modelData
|
required property var modelData
|
||||||
|
|
||||||
Layout.preferredWidth: 200
|
width: 200
|
||||||
Layout.preferredHeight: 140
|
height: 140
|
||||||
Layout.minimumWidth: 200
|
|
||||||
Layout.minimumHeight: 140
|
// Center in cell
|
||||||
Layout.maximumWidth: 200
|
x: (wallpaperGrid.cellWidth - width) / 2
|
||||||
Layout.maximumHeight: 140
|
y: (wallpaperGrid.cellHeight - height) / 2
|
||||||
|
|
||||||
readonly property bool isCurrent: modelData.path === Wallpapers.actualCurrent
|
readonly property bool isCurrent: modelData.path === Wallpapers.actualCurrent
|
||||||
|
|
||||||
|
|
@ -2085,5 +2088,4 @@ RowLayout {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue