fixes button
This commit is contained in:
+30
-11
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user