[Interest] RowLayout with Text with wrap mode
Jérôme Godbout
godboutj at amotus.ca
Mon Mar 5 19:36:48 CET 2018
your BTW is the problems, parent size and anchors are not really working into a ListView delegate, which make some component reuse a bit hard with ListView sometime. When using a Layout into the delegate it's only the layout sizing that will have effect (normal size or other parent filll got ignored). If you don't see any problems with that, fine, I do.
________________________________
From: gr3cko at gmail.com <gr3cko at gmail.com> on behalf of Pierre-Yves Siret <py.siret at gmail.com>
Sent: Monday, March 5, 2018 9:00 AM
To: Jérôme Godbout
Cc: Igor Mironchik; Qt Project
Subject: Re: [Interest] RowLayout with Text with wrap mode
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
_______________________________________________
Interest mailing list
Interest at qt-project.org<mailto: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/f59eb62c/attachment.html>
More information about the Interest
mailing list