How to stretch rectangle height with label?
Solved
Mobile and Embedded
-
I have:
https://pastebin.com/8jZ201jnHow to stretch rectangle height with label?
-
it will help you http://doc.qt.io/qt-5/qml-qtquick-textmetrics.html
-
TextMetrics { id: textMetrics //font.family: "Arial" elide: Text.ElideMiddle //textWarp: elideWidth: Screen.width text: "Stworzyliśmy olbrzymią bazę pytań z egzaminów zawodowych! Napracowaliśmy się co nie miara, ale było warto - pytania pochodzą wprost z arkuszy egzaminacyjnych i jest ich łącznie aż 1691 (758 pytań E.12 + 568 pytań E.13 + 365 pytań E.14). Znajdziesz tutaj także wyjątkowe wykłady i tutoriale video, dostępne całkowicie za darmo!" }
but textMetrics.boundingRect.height is only 15
-
I used layout previous but i had:
Layout.preferredWidth: Screen.width/2
and
height: childrenRect.height
in rectangle, this don't work.
I had to change
height: childrenRect.height
property on
Layout.preferredHeight: childrenRect.height
and this working:
Rectangle{ Layout.alignment: Qt.AlignTop | Qt.AlignHCenter Layout.preferredWidth: Screen.width/2 Layout.preferredHeight: childrenRect.height color: "red" Label{ width: parent.width wrapMode: Text.WordWrap text: "Stworzyliśmy olbrzymią bazę pytań z egzaminów zawodowych! Napracowaliśmy się co nie miara, ale było warto - pytania pochodzą wprost z arkuszy egzaminacyjnych i jest ich łącznie aż 1691 (758 pytań E.12 + 568 pytań E.13 + 365 pytań E.14). Znajdziesz tutaj także wyjątkowe wykłady i tutoriale video, dostępne całkowicie za darmo!" font.pointSize: 18 color: "#8E9198" horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter } }