Results 1 to 2 of 2

Thread: Adding layout on groupBox

  1. #1
    Join Date
    Dec 2010
    Posts
    11
    Thanks
    1

    Default Adding layout on groupBox

    Hi all,

    I am testing some things in the QtCreator. I made simple formular with groupBox. I added grid layout to the groupBox to position all the containing objects in grid.

    I am trying to do the same in cpp file (programmatically), but the layout didn't get set. I use

    Qt Code:
    1. QGridLayout *layout = new QGridLayout;
    2. ui->groupBox_main->setLayout(layout);
    To copy to clipboard, switch view to plain text mode 

    where groupBox_main is the groupBox I want to set to grid. Can anyone help a little?

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Adding layout on groupBox

    You have to add the widgets you want to be in the layout to the layout!
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

Similar Threads

  1. Replies: 0
    Last Post: 12th December 2010, 06:09
  2. Replies: 6
    Last Post: 23rd August 2010, 18:56
  3. Adding a Layout to QMainWindow
    By Chiggins in forum Qt Programming
    Replies: 2
    Last Post: 7th June 2010, 07:25
  4. A question about adding to layout
    By Cruz in forum Qt Programming
    Replies: 1
    Last Post: 20th January 2009, 13:41
  5. Adding qpaint object to a Layout
    By Rooster in forum Newbie
    Replies: 6
    Last Post: 13th February 2008, 14:12

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.