Horizontal alignment of wrapped text not working on Linux
-
Hi, I have the following code:
Rectangle{ color: "black" Layout.fillHeight: true Layout.fillWidth: true Text{ width: parent.width anchors.horizontalCenter: parent.horizontalCenter y: parent.height / 4 font.family: openSansFont.name font.pointSize: 30 text: "COMP\nwww.somewebpage.com" horizontalAlignment: Text.AlignHCenter color: "white" } } //Rectangle
I want the text to be wrapped (with respect to the new line symbol, which works) and aligned to the horizontal center. The thing is it only works on my dev Windows computer. On the target Raspbian distribution it looks like the line:
horizontalAlignment: Text.AlignHCenter
...is completely ignored. The text is wrapped in both cases, but the alignment works only on Windows.
I could separate the text in 2 and align them separately but that in my case it would mean splitting really large number of objects which have all the properties the same - that would create a huge code redundancy.
So what shall I do to make it work on Linux as well?
Thanks
-
You haven't provided a complete example that demonstrates the problem, but guessing at what contains the Rectangle, it works as expected for me on Mint 17.
-
That's what I was afraid of...
Actually there's more to it. I realized that my dev computer QT is 5.4 whereas the Raspbian target computer has 5.2, which is more likely the problem than the target platform. I'd say that this is some bug present in 5.2 which was fixed in the following versions... What is your QT version?
You haven't provided a complete example that demonstrates the problem
The entire code is really huge, and I guess it is irrelevant anyway. The code I posted should be enough to reproduce the problem. I'll try to run it in qmlscene on my Raspbian.
//edit: Strange, the code i posted seems to run in qmlscene (5.2) just fine...
-
@Aros said:
What is your QT version?
I tested with 5.4.2.
You haven't provided a complete example that demonstrates the problem
The entire code is really huge, and I guess it is irrelevant anyway.
We don't need the entire code, just a minimal, self-contained example that shows the problem.
-
I'll try to make one, but it will take 2 days as I'm not at home right now.