Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

max/min function in QML

Tags:

qt

qml

I would like to set the height of an element. It should be the height of the highest child element.

Is there something like:

Parent {
    height: max(child1.height, child2.height)
}

Alternatively something like:

Parent {
    height: stretchToChildren
}
like image 515
problemofficer - n.f. Monica Avatar asked Aug 01 '13 15:08

problemofficer - n.f. Monica


1 Answers

Math.max() is variadic (taking arbitrarily many arguments).

Depending on actual layout, it might be possible to use Item.childrenRect property.

like image 67
sergk Avatar answered Sep 18 '22 10:09

sergk