[Interest] RowLayout with Text with wrap mode

Jérôme Godbout godboutj at amotus.ca
Mon Mar 5 14:34:21 CET 2018


You need to specify a width to your Text element so the wrap around can occur. Else the Text consider it should set the width according to the text and therefor no wrap around is possible. If you want dynamic width range, you should consider Layout.minimumWidth and Layout.maximumWidth with different value.


________________________________
From: Interest <interest-bounces+godboutj=amotus.ca at qt-project.org> on behalf of Igor Mironchik <igor.mironchik at gmail.com>
Sent: Saturday, March 3, 2018 2:24 AM
To: Qt Project
Subject: [Interest] RowLayout with Text with wrap mode

Hello,

I have a delegate for ListView with RowLayout inside:

RowLayout {
                 anchors.fill: parent
                 spacing: 20
                 width: parent.width

                 ColumnLayout {
                     id: col
                     anchors.left: parent.left
                     spacing: 5

                     Text {
                         text: type === 0 ? qsTr( "<b>Place: </b>" ) +
model[ "PlaceRole" ] :
                             qsTr( "<b>Code: </b>" ) + model[ "CodeRole" ]
                     }

                     Text {
                         text: qsTr( "<b>Amount: </b>" ) + model[
"AmountRole" ]
                     }
                 }

                 Text {
                     text: model[ "DescRole" ]
                     wrapMode: Text.WordWrap
                 }
             }


All is fine with except that the last Text item doesn't wrap text. How
can I workaround it? Thanks.

_______________________________________________
Interest mailing list
Interest at qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20180305/97aacc21/attachment.html>


More information about the Interest mailing list