Make ButtonLayout faster and more precise
This commit is contained in:
parent
7227ac04a3
commit
1ad3de3917
@ -5,19 +5,19 @@ import QtQuick.Layouts 1.12
|
||||
import ".."
|
||||
|
||||
HGridLayout {
|
||||
readonly property int summedImplicitWidth: {
|
||||
const widths = []
|
||||
readonly property real summedImplicitWidth: {
|
||||
let sum = 0
|
||||
|
||||
for (let i = 0; i < visibleChildren.length; i++) {
|
||||
const item = visibleChildren[i]
|
||||
if (item) widths.push(item.width > 0 ? item.implicitWidth : 0)
|
||||
if (item) sum += item.width > 0 ? item.implicitWidth : 0
|
||||
}
|
||||
|
||||
return utils.sum(widths)
|
||||
return sum
|
||||
}
|
||||
|
||||
flow:
|
||||
width >= summedImplicitWidth ?
|
||||
GridLayout.LeftToRight :
|
||||
GridLayout.TopToBottom
|
||||
HGridLayout.LeftToRight :
|
||||
HGridLayout.TopToBottom
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user