[Interest] RowLayout with Text with wrap mode

Igor Mironchik igor.mironchik at gmail.com
Mon Mar 5 18:20:19 CET 2018


Hi,

Thank you guys. Layout.fillWidth: true and width: parent.width together 
did the task.

I have one more question: what if I have anchors.left: parent.left that 
is not necessary, will be in this case some performance issue with it? 
Or I can just forget about not necessary bindings?

On 05.03.2018 17:00, Pierre-Yves Siret wrote:
> You should always set a width for Text items (and a wrapMode and/or 
> elide mode), unless you want your text to have no horizontal limit.
> In your case you need to correct your code (it's not a workaround 
> since it's the intended behaviour) is to set a width for your Texts 
> (the 3).
> Do this by using `Layout.fillWidth: true`.
>
> BTW : your width: parent.width and anchors.left: parent.left have no 
> effect here
>
> I have not met the problems mentionned by Jérôme and using ListView is 
> perfectly fine with me.
>
>
> 2018-03-05 14:42 GMT+01:00 Jérôme Godbout <godboutj at amotus.ca 
> <mailto:godboutj at amotus.ca>>:
>
>     All the *View* type are a bit of a pain with Layout item. You need
>     to specify the height and width properly with the
>     Layout.minimumWidth/Height and maximum values. If you don't need
>     all the animation stuff from ListView, you can do a simple
>     GridLayout and fill the element which would be way simpler and you
>     will have full control on the sizing without the pain.
>
>
>     I for one, try to avoid the *View* element as much as possible.
>     Good GridLayout make it easier and you can even declare the items
>     by specifying the columns and row making a different repeater by
>     row or by column possible.
>
>     ------------------------------------------------------------------------
>     *From:* Interest
>     <interest-bounces+godboutj=amotus.ca at qt-project.org
>     <mailto:amotus.ca at qt-project.org>> on behalf of Igor Mironchik
>     <igor.mironchik at gmail.com <mailto:igor.mironchik at gmail.com>>
>     *Sent:* Saturday, March 3, 2018 4:18 AM
>     *To:* Qt Project
>     *Subject:* Re: [Interest] RowLayout with Text with wrap mode
>     I know that changing RowLayout to simple Row will solve the
>     problem. But
>     is it possible to solve this with layout?
>
>
>     On 03.03.2018 10:24, Igor Mironchik wrote:
>     > 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 <mailto:Interest at qt-project.org>
>     http://lists.qt-project.org/mailman/listinfo/interest
>     <http://lists.qt-project.org/mailman/listinfo/interest>
>
>     _______________________________________________
>     Interest mailing list
>     Interest at qt-project.org <mailto:Interest at qt-project.org>
>     http://lists.qt-project.org/mailman/listinfo/interest
>     <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/1ee91c6d/attachment.html>


More information about the Interest mailing list