2020-09-23 19:57:54 -04:00
|
|
|
// Copyright Mirage authors & contributors <https://github.com/mirukana/mirage>
|
2019-12-19 07:46:16 -04:00
|
|
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
|
|
|
|
2019-09-09 12:37:01 -04:00
|
|
|
import QtQuick.Controls 2.12
|
|
|
|
import QtQuick 2.12
|
|
|
|
|
|
|
|
Repeater {
|
|
|
|
id: repeater
|
|
|
|
|
2019-12-19 15:56:07 -04: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-19 15:49:29 -04:00
|
|
|
}
|
|
|
|
|
2019-12-19 15:56:07 -04:00
|
|
|
return widths
|
2019-09-19 15:49:29 -04:00
|
|
|
}
|
|
|
|
|
2019-12-19 15:56:07 -04:00
|
|
|
readonly property var childrenWidth: {
|
|
|
|
const widths = []
|
2019-09-19 15:49:29 -04:00
|
|
|
|
2019-12-19 15:56:07 -04: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-09 12:37:01 -04:00
|
|
|
}
|
|
|
|
|
2019-12-19 15:56:07 -04:00
|
|
|
return widths
|
2019-09-09 12:37:01 -04:00
|
|
|
}
|
2019-12-19 15:56:07 -04: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-09 12:37:01 -04:00
|
|
|
}
|