Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Text baseline alignment
Forum Updated to NodeBB v4.3 + New Features

Text baseline alignment

Scheduled Pinned Locked Moved General and Desktop
7 Posts 3 Posters 4.0k 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.
  • L Offline
    L Offline
    lite
    wrote on last edited by lite
    #1

    Hi, I'm trying to align widgets so the baselines of the contained text are aligned. In the pictures below (both with normal size widgets and small widgets), you can see that the text in the QLabel and QComboBox are not baseline aligned. This happens with other widgets also, i.e. QLineEdit. I tried doing setAlignment(Qt::AlignBaseline) on individual widgets and also the QHBoxLayout that contains them, but it didn't fix it. Am I doing something wrong or is this a Qt issue? Thanks.


    1 Reply Last reply
    0
    • joeQJ Offline
      joeQJ Offline
      joeQ
      wrote on last edited by
      #2

      ou,There isn't any pictires. would you show some pictures?

      Just do it!

      1 Reply Last reply
      0
      • L Offline
        L Offline
        lite
        wrote on last edited by
        #3

        There should be some pictures there. If not, here are the links:
        http://i.imgur.com/hdJroT7.png
        http://i.imgur.com/DFfKQWv.png

        p3c0P 1 Reply Last reply
        0
        • L lite

          There should be some pictures there. If not, here are the links:
          http://i.imgur.com/hdJroT7.png
          http://i.imgur.com/DFfKQWv.png

          p3c0P Offline
          p3c0P Offline
          p3c0
          Moderators
          wrote on last edited by
          #4

          @lite You can align QLabel's text to bottom.

          label->setAlignment(Qt::AlignBottom);
          

          157

          1 Reply Last reply
          0
          • L Offline
            L Offline
            lite
            wrote on last edited by
            #5

            @p3c0 It still doesn't align the baselines of the text. Now, the baseline for the label is below the one for the combo box.

            p3c0P 1 Reply Last reply
            0
            • L lite

              @p3c0 It still doesn't align the baselines of the text. Now, the baseline for the label is below the one for the combo box.

              p3c0P Offline
              p3c0P Offline
              p3c0
              Moderators
              wrote on last edited by
              #6

              @lite Can you show how do you want it actually ? Can you share some screen ?

              157

              1 Reply Last reply
              0
              • L Offline
                L Offline
                lite
                wrote on last edited by
                #7

                @p3c0 Like this (without the red line, obviously):

                See how the text "Type" and "Sprite" texts are aligned at the bottom?

                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