Move AutoDirectionLayout sum function to Utils
This commit is contained in:
parent
acd02a67a0
commit
93b46dcfee
|
@ -4,18 +4,8 @@ import QtQuick 2.12
|
||||||
import QtQuick.Layouts 1.12
|
import QtQuick.Layouts 1.12
|
||||||
|
|
||||||
HGridLayout {
|
HGridLayout {
|
||||||
readonly property real summedImplicitWidth: {
|
readonly property real summedImplicitWidth:
|
||||||
let sum = 0
|
utils.sumChildrenImplicitWidths(visibleChildren, columnSpacing)
|
||||||
|
|
||||||
for (let i = 0; i < visibleChildren.length; i++) {
|
|
||||||
const item = visibleChildren[i]
|
|
||||||
|
|
||||||
if (item)
|
|
||||||
sum += (item.width > 0 ? item.implicitWidth : 0) +columnSpacing
|
|
||||||
}
|
|
||||||
|
|
||||||
return sum
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
flow:
|
flow:
|
||||||
|
|
|
@ -498,4 +498,17 @@ QtObject {
|
||||||
userId, "send_file", [roomId, path], onSuccess, onError,
|
userId, "send_file", [roomId, path], onSuccess, onError,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function sumChildrenImplicitWidths(visibleChildren, spacing=0) {
|
||||||
|
let sum = 0
|
||||||
|
|
||||||
|
for (let i = 0; i < visibleChildren.length; i++) {
|
||||||
|
const item = visibleChildren[i]
|
||||||
|
|
||||||
|
if (item)
|
||||||
|
sum += (item.width > 0 ? item.implicitWidth : 0) + spacing
|
||||||
|
}
|
||||||
|
|
||||||
|
return sum
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user