moment/src/gui/Base/HRepeater.qml

41 lines
996 B
QML
Raw Normal View History

2019-12-19 22:46:16 +11:00
// SPDX-License-Identifier: LGPL-3.0-or-later
import QtQuick.Controls 2.12
import QtQuick 2.12
Repeater {
id: repeater
2019-12-20 06:56:07 +11:00
readonly property var childrenImplicitWidth: {
const widths = []
for (let i = 0; i < repeater.count; i++) {
const item = repeater.itemAt(i)
if (item)
widths.push(item.implicitWidth > 0 ? item.implicitWidth : 0)
}
2019-12-20 06:56:07 +11:00
return widths
}
2019-12-20 06:56:07 +11:00
readonly property var childrenWidth: {
const widths = []
2019-12-20 06:56:07 +11:00
for (let i = 0; i < repeater.count; i++) {
const item = repeater.itemAt(i)
if (item) widths.push(item.width > 0 ? item.width : 0)
}
2019-12-20 06:56:07 +11:00
return widths
}
2019-12-20 06:56:07 +11:00
readonly property real summedWidth: utils.sum(childrenWidth)
readonly property real summedImplicitWidth:utils.sum(childrenImplicitWidth)
readonly property real thinestChild: Math.min(...childrenWidth)
readonly property real widestChild: Math.max(...childrenWidth)
}