2020-09-24 09:57:54 +10:00
|
|
|
// Copyright Mirage authors & contributors <https://github.com/mirukana/mirage>
|
2019-12-19 22:46:16 +11:00
|
|
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
|
|
|
|
2019-09-10 02:37:01 +10:00
|
|
|
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-09-20 05:49:29 +10:00
|
|
|
}
|
|
|
|
|
2019-12-20 06:56:07 +11:00
|
|
|
return widths
|
2019-09-20 05:49:29 +10:00
|
|
|
}
|
|
|
|
|
2019-12-20 06:56:07 +11:00
|
|
|
readonly property var childrenWidth: {
|
|
|
|
const widths = []
|
2019-09-20 05:49:29 +10:00
|
|
|
|
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-09-10 02:37:01 +10:00
|
|
|
}
|
|
|
|
|
2019-12-20 06:56:07 +11:00
|
|
|
return widths
|
2019-09-10 02:37:01 +10:00
|
|
|
}
|
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)
|
2019-09-10 02:37:01 +10:00
|
|
|
}
|