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. Text ImplicitHeight differences between iOS and Windows?
Forum Updated to NodeBB v4.3 + New Features

Text ImplicitHeight differences between iOS and Windows?

Scheduled Pinned Locked Moved QML and Qt Quick
5 Posts 2 Posters 1.4k Views 2 Watching
  • 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.
  • S Offline
    S Offline
    swoods
    wrote on last edited by
    #1

    Newbie here - first post. I've done some searching for this issue, but no one has addressed the specific issue I have that I could find.

    I am working on a GUI that is currently being run on both Windows and iOS, using Qt5.4 and QML. We will eventually have to run on Linux as well, but I haven't tested this issue on that OS yet.

    Right now, we are handling the font size differences between Windows and iOS by using different pointSizes depending on the operating system. The rest of QML components size themselves based on resolution and Layouts. All Text currently uses the "Tahoma" family.

    I noticed that the vertical positioning of our fonts on the iOS looked slightly off compared to the Windows GUI. For instance, if I have a Rectangle QML component with a Text component centered vertically in it (I tried various means - both Layout and anchors), the font in the iOS always looked slightly off -- a little high. Everything looked fine in Windows.

    After some experimentation, I found that the implicitHeight of the Text Component in Windows included a space above the text that roughly equaled the space below that equals the Text component's baselineOffset. On iOS, this space above the Text does not exist -- the text is not "centered" vertically in the Text's implicitHeight -- it is flush against the top, while in Windows it is in the middle.

    So -- the layout/anchoring I do in the QML, which centers the Text vertically looks great on Windows, but is slightly off in iOS. Before I add more "if using iOS" conditionals for how I center Text components -- does someone have a suggestion how to handle vertically centering Text that would work for both OS's? Am I missing something crucial here?

    Thanks.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      You should test this with Qt 5.5. to see if the situation has changed in between

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      S 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi and welcome to devnet,

        You should test this with Qt 5.5. to see if the situation has changed in between

        S Offline
        S Offline
        swoods
        wrote on last edited by
        #3

        @SGaist

        Just rebuilt with Qt5.5, and still have the same issue. Bummer, I was hoping this would be a quick fix!

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Then you should take a look at the bug report system to see if it's something known

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          S 1 Reply Last reply
          0
          • SGaistS SGaist

            Then you should take a look at the bug report system to see if it's something known

            S Offline
            S Offline
            swoods
            wrote on last edited by
            #5

            @SGaist

            Took a look at the bug reports -- judging by QTBUG-43226, which is still unresolved, there does seem to be some issues with Text.alignVCenter. I got pulled off on another task, but when I get back to this I am going to try using some different anchors for aligning the text to see if that will fix the issue.

            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