Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Horizontal alignment of wrapped text not working on Linux

Horizontal alignment of wrapped text not working on Linux

Scheduled Pinned Locked Moved QML and Qt Quick
5 Posts 2 Posters 1.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Aros
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • X Offline
      X Offline
      xargs1
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Aros
        wrote on last edited by Aros
        #3

        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...

        X 1 Reply Last reply
        0
        • A Aros

          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...

          X Offline
          X Offline
          xargs1
          wrote on last edited by
          #4

          @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.

          1 Reply Last reply
          0
          • A Offline
            A Offline
            Aros
            wrote on last edited by
            #5

            I'll try to make one, but it will take 2 days as I'm not at home right now.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved