Word wrap in QML rectangle
-
wrote on 2 Nov 2016, 13:59 last edited by
Consider the following code:
Rectangle { id: message_row Layout.fillWidth: true Layout.fillHeight: true color: "transparent" RowLayout { anchors.fill: parent spacing: 0 Rectangle { anchors.fill: parent color: "transparent" Text { id: message_text text: getText() font: tap_fonts.default_font verticalAlignment: Text.AlignVCenter horizontalAlignment: Text.AlignHCenter anchors.fill: parent wrapMode: Text.WordWrap } } } }
What I am finding is that the message text is not always wrapping. Depending on what machine I am running on, or platform it either works fine, or the text is centered with the left and right ends truncated.
Am I doing something wrong?
-
wrote on 2 Nov 2016, 17:55 last edited by
Hi! Could you please check if this also happens when the Text isn't placed in a RowLayout (actually in no layout at all)? Smells like QTBUG-33097.
-
wrote on 4 Nov 2016, 12:41 last edited by
@DRoscoe
I run your code and figured out that you must need to define width and height of first Rectangle. So try it first and let me know if any issue come again.. -
@DRoscoe
I run your code and figured out that you must need to define width and height of first Rectangle. So try it first and let me know if any issue come again..wrote on 4 Nov 2016, 12:45 last edited by@Vicky-Sharma That did the trick. Still not sure why it sometimes works without that such as on the iPad or some of our computers.
1/4