HBox: make buttons a column if not enough width
This commit is contained in:
@@ -70,10 +70,13 @@ Rectangle {
|
||||
Layout.rightMargin: interfaceBox.horizontalSpacing
|
||||
}
|
||||
|
||||
HRowLayout {
|
||||
HGridLayout {
|
||||
id: buttonGrid
|
||||
visible: buttonModel.length > 0
|
||||
flow: width >= buttonRepeater.childrenImplicitWidth ?
|
||||
GridLayout.LeftToRight : GridLayout.TopToBottom
|
||||
|
||||
Repeater {
|
||||
HRepeater {
|
||||
id: buttonRepeater
|
||||
model: []
|
||||
|
||||
|
17
src/qml/Base/HRepeater.qml
Normal file
17
src/qml/Base/HRepeater.qml
Normal file
@@ -0,0 +1,17 @@
|
||||
import QtQuick.Controls 2.12
|
||||
import QtQuick 2.12
|
||||
|
||||
|
||||
Repeater {
|
||||
id: repeater
|
||||
|
||||
readonly property int childrenImplicitWidth: {
|
||||
let total = 0
|
||||
|
||||
for (let i = 0; i < repeater.count; i++) {
|
||||
total += repeater.itemAt(i).implicitWidth
|
||||
}
|
||||
|
||||
return total
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user