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. GroupBox positioning in the main window
Forum Updated to NodeBB v4.3 + New Features

GroupBox positioning in the main window

Scheduled Pinned Locked Moved General and Desktop
2 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.
  • T Offline
    T Offline
    thomas11live.com.sg
    wrote on last edited by
    #1

    Dear All,
    I have three group boxes, horizontalGroupBox, gridGroupBox and formGroupBox.
    If I add like that in the program, they all are positioned vertically.

    mainLayout->addWidget(horizontalGroupBox);
    mainLayout->addWidget(gridGroupBox);
    mainLayout->addWidget(formGroupBox);

    But I want to arrange them, horizontalGroupBox is the first group box at the first row and
    gridGroupBox and formGroupBox are at the second row and these two are side by side.
    How can I arrange them in the program?
    Thanks

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

      Hi,

      I expect mainLayout is a VBoxLayout?
      You can cascade the layouts or use a grid layoud to achieve what you want.
      e.g.:

      @
      QGridLayout* mainLayout = ...
      mainLayout->addWidget(horizontalGroupBox, 0, 0, 1, 2);
      mainLayout->addWidget(gridGroupBox, 1, 0);
      mainLayout->addWidget(formGroupBox, 1, 1);
      @

      Disclaimer: written directly from brain, no guarantee... ;-)

      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

      • Login

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