3

Consider the following page in a QML application:

Page {
    Text {
        anchors.fill: parent
        anchors.margins: units.gu(2)
        horizontalAlignment: Text.AlignJustify
        text: "aaaaaa aaaaaa aaaaaa aaaaaa aaaaaa aaaaaa aaa aaa aaa aaa aaa aaa aaa aaa."
        wrapMode: Text.WordWrap
    }
}

I expect that the contents of the Text element would be justified but this is clearly not the case:

enter image description here

As you can see, the first line is not justified as it should be. What am I doing wrong?

0

1 Answer 1

4

I ran your qml snippet in this qml file on Ubuntu 13.10:

import QtQuick 2.0
import Ubuntu.Components 0.1


MainView {
    id: main
    width: units.gu(30)
    height: units.gu(35)

    Page {
        Text {
            anchors.fill: parent
            anchors.margins: units.gu(2)
            horizontalAlignment: Text.AlignJustify
            text: "aaaaaa aaaaaa aaaaaa aaaaaa aaaaaa aaaaaa aaa aaa aaa aaa aaa aaa aaa aaa."
            wrapMode: Text.WordWrap
        }
    }
}

And I can say that it works perfectly, the text is properly justified:

enter image description here

7
  • Copying-and-pasting your code results in this: i.stack.imgur.com/MICdj.png I didn't mention it in the question, but I'm using Trusty. This might be a bug. Mar 17, 2014 at 20:17
  • Qt 5.2.1 landed in trusty last week. Which version is installed in your system? (type qmake -v) Mar 17, 2014 at 20:27
  • I have 5.2.1 installed. Mar 17, 2014 at 20:30
  • 2
    I can confirm the bug, just tested on trusty. All types of alignment work except justify. Mar 17, 2014 at 21:34
  • Would you like me to file a bug on LP? Mar 18, 2014 at 6:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .