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. Design of Layout
Qt 6.11 is out! See what's new in the release blog

Design of Layout

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.4k 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
    ankush205
    wrote on last edited by
    #1

    I have ten buttons on a Qlabel.i want to align 5 buttons to top left and 5 buttons to center bottom

    so i create a Qhorizontaltab to save topleft button and assign it

    @horizontaltab=new QHBoxLayout(label);
    horizontaltab->setAlignment(Qt::AlignLeft|Qt::AlignTop); @

    and other buttons are added to another horizontal layout
    @horizontal=new QHBoxLayout(label);
    horizontal->setAlignment(Qt::Aligncenter|Qt::AlignBottom); @

    Now how can i add another layout to save these two layouts?

    1 Reply Last reply
    0
    • JeroentjehomeJ Offline
      JeroentjehomeJ Offline
      Jeroentjehome
      wrote on last edited by
      #2

      Ok,
      Are you using designer? If not, please, do use it, then check out the ui file code how it is done.

      Greetz, Jeroen

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

        Fine .it would be helpful if i could simply write a code.becuase i never use Ui designer

        1 Reply Last reply
        0
        • JeroentjehomeJ Offline
          JeroentjehomeJ Offline
          Jeroentjehome
          wrote on last edited by
          #4

          Hi, I'm not saying you should utilize designer in your design, but it gives good example what is possible with standard Qt GUI design widgets.
          But here goes:

          • place the 5 buttons both in horizontal layout (you already did this)
          • place those layouts in a gridlayout or maybe matrixlayout
          • Add spacers on the left and right side of it when you to centre the buttons
          • Add spacers to the right side of the buttons to left align them.

          Greetz, Jeroen

          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