Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 4 down vote accepted

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

share|improve this answer
    
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. –  Nathan Osman Mar 17 at 20:17
    
Qt 5.2.1 landed in trusty last week. Which version is installed in your system? (type qmake -v) –  Sylvain Pineau Mar 17 at 20:27
    
I have 5.2.1 installed. –  Nathan Osman Mar 17 at 20:30
2  
I can confirm the bug, just tested on trusty. All types of alignment work except justify. –  Sylvain Pineau Mar 17 at 21:34
    
Would you like me to file a bug on LP? –  Nathan Osman Mar 18 at 6:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.