booru: prevent GOAWAY on sidebar resize

This commit is contained in:
end-4
2025-05-05 15:31:49 +02:00
parent a6098a007a
commit db0f077c3b
@@ -22,7 +22,7 @@ Rectangle {
property string downloadPath property string downloadPath
property string nsfwPath property string nsfwPath
property real availableWidth: parent.width ?? 0 property real availableWidth: parent.width
property real rowTooShortThreshold: 185 property real rowTooShortThreshold: 185
property real imageSpacing: 5 property real imageSpacing: 5
property real responsePadding: 5 property real responsePadding: 5
@@ -31,6 +31,26 @@ Rectangle {
anchors.right: parent?.right anchors.right: parent?.right
implicitHeight: columnLayout.implicitHeight + root.responsePadding * 2 implicitHeight: columnLayout.implicitHeight + root.responsePadding * 2
Component.onCompleted: {
// Break property bind to prevent aggressive updates
availableWidth = parent.width
}
Connections {
target: parent
function onWidthChanged() {
updateWidthTimer.restart()
}
}
Timer {
id: updateWidthTimer
interval: 100
onTriggered: {
availableWidth = parent.width
}
}
radius: Appearance.rounding.normal radius: Appearance.rounding.normal
color: Appearance.colors.colLayer1 color: Appearance.colors.colLayer1
@@ -159,7 +179,8 @@ Rectangle {
} }
Repeater { Repeater {
model: { model: ScriptModel {
values: {
// Group two images every row, ensuring they are of the same height // Group two images every row, ensuring they are of the same height
// If the height ends up being too small, put one image in the row and continue // If the height ends up being too small, put one image in the row and continue
// In other words, this is similar to Android's gallery layout at largest zoom level // In other words, this is similar to Android's gallery layout at largest zoom level
@@ -199,6 +220,7 @@ Rectangle {
} }
return rows; return rows;
} }
}
delegate: RowLayout { delegate: RowLayout {
id: imageRow id: imageRow
property var rowHeight: modelData.height property var rowHeight: modelData.height