fixes button

This commit is contained in:
2026-06-26 14:45:42 +03:00
parent 84a007f9d0
commit cdb731d837
33 changed files with 594 additions and 99 deletions
+30 -11
View File
@@ -35,18 +35,37 @@ Window {
Component {
id: gridComp
GridView {
id: gridView
Item {
id: gridRoot
anchors.fill: parent
cellWidth: Math.max(64, width / Math.max(1, settingsContainer.layoutColumns))
cellHeight: cellWidth
model: buttonsModel
clip: true
interactive: true
delegate: ButtonDelegate {
width: gridView.cellWidth - settingsContainer.layoutSpacing
height: gridView.cellHeight - settingsContainer.layoutSpacing
showLabel: settingsContainer.showLabels
readonly property int gridColumns: Math.max(1, settingsContainer.layoutColumns)
readonly property real cellSide: Math.max(64, width / gridColumns)
readonly property int gridRows: buttonsModel.count === 0
? 0
: Math.ceil(buttonsModel.count / gridColumns)
readonly property real gridContentHeight: gridRows * cellSide
readonly property bool gridFits: gridContentHeight > 0
&& gridContentHeight <= height
GridView {
id: gridView
width: gridRoot.width
height: gridRoot.gridFits ? gridRoot.gridContentHeight : gridRoot.height
y: gridRoot.gridFits ? (gridRoot.height - gridRoot.gridContentHeight) / 2 : 0
cellWidth: gridRoot.cellSide
cellHeight: gridRoot.cellSide
model: buttonsModel
clip: true
interactive: !gridRoot.gridFits
boundsBehavior: Flickable.StopAtBounds
delegate: ButtonDelegate {
width: gridView.cellWidth - settingsContainer.layoutSpacing
height: gridView.cellHeight - settingsContainer.layoutSpacing
showLabel: settingsContainer.showLabels
}
}
}
}