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. Layout alignment across widgets
Forum Updated to NodeBB v4.3 + New Features

Layout alignment across widgets

Scheduled Pinned Locked Moved General and Desktop
8 Posts 5 Posters 6.5k Views 1 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.
  • A Offline
    A Offline
    andre
    wrote on last edited by
    #1

    I am dealing with a form that contains a stacked widget. This allows the form to change its contents based on the selection made in a combo box. This is the form I'm talking about: http://imagebin.org/140899 , .ui source can be found here: http://pastebin.com/Xf1rXJe5

    The part stacked widget has been highlighted with a blue box. What I'd like to achieve, is to create a nice alignment between all the widgets on the form, no matter if they are part of the stacked widget or not. I'd even like to be able to make sure the alignment between the different pages stays the same. For instance, I'd like all the widgets on the form to align to the green line I drew on the image above.

    I am sure others have come across this problem before, or have dealt with similar problems like aligning widgets inside of different group boxes that are above another on the same form.

    I find that scenario's like these, which I imagine to be quite common, is a weakness of Qt's layout system. What tricks do others use to work around this, and provide nicely aligned widgets even across different parent widgets?

    1 Reply Last reply
    0
    • D Offline
      D Offline
      deimos
      wrote on last edited by
      #2

      http://imagebin.org/140899 give me 404 not found

      1 Reply Last reply
      0
      • G Offline
        G Offline
        giesbert
        wrote on last edited by
        #3

        without the comma attached, it works :-)
        changed in the post

        Nokia Certified Qt Specialist.
        Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

        1 Reply Last reply
        0
        • D Offline
          D Offline
          deimos
          wrote on last edited by
          #4

          ouch didnt seen :)

          IMHO the solution is to set a minimun size to all the labels on the left, for example to 98 like the upper "Database type:"

          1 Reply Last reply
          0
          • T Offline
            T Offline
            tobias.hunger
            wrote on last edited by
            #5

            I ran into this blog post recently:
            http://agateau.wordpress.com/2011/01/28/clean-up-your-layouts-with-columnresizer/

            Might be a KDE-based solution, I have not yet checked it out.

            1 Reply Last reply
            0
            • A Offline
              A Offline
              andre
              wrote on last edited by
              #6

              [quote author="Marco Bavagnoli" date="1299155208"]ouch didnt seen :)

              IMHO the solution is to set a minimun size to all the labels on the left, for example to 98 like the upper "Database type:"[/quote]

              I'd rather not use fixed magic numbers. What would happen in a translated version of my application, for instance? In that case, the minimum label width might be completely different.

              [quote author="Tobias Hunger" date="1299156197"]I ran into this blog post recently:
              http://agateau.wordpress.com/2011/01/28/clean-up-your-layouts-with-columnresizer/

              Might be a KDE-based solution, I have not yet checked it out.
              [/quote]

              This looks like what I need, thanks a lot!

              Edit: indeed, this works quite nicely. It is not as slick as having this integrated in Qt proper, but it works nicely nonetheless.

              1 Reply Last reply
              0
              • R Offline
                R Offline
                rajeevbhutani001
                wrote on last edited by
                #7

                [quote author="Tobias Hunger" date="1299156197"]I ran into this blog post recently:
                http://agateau.wordpress.com/2011/01/28/clean-up-your-layouts-with-columnresizer/

                Might be a KDE-based solution, I have not yet checked it out.
                [/quote]

                This link was really useful for me.
                Thanks for this link posting.

                [url=http://aquariusmediaa.com/]Ad agency in delhi[/url] | [url=http://awebsitedevelopment.com]Website Development[/url]

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  andre
                  wrote on last edited by
                  #8

                  To show off the result of the corrected form using the ColumnResizer class from the blogposting Tobias pointed to:

                  http://imagebin.org/141128

                  Everything nicely aligned, even between the different pages from the widget stack that appear when you change the database type from the combo box.

                  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