Results 1 to 3 of 3

Thread: Adding a Layout to QMainWindow

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2010
    Posts
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Adding a Layout to QMainWindow

    Alright, I'm a little new to Qt....

    I have a QGridLayout with all of my content in it.. How could I apply it to a QMainWindow?

    Thanks

  2. #2
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Adding a Layout to QMainWindow

    QMainWindow has a setLayout(QLayout*) member function.

    Or alternate way is to use QWidget with parent 0 as a main window, and pass the pointer as a parameter to the creation of layout (or use setLayout(...))
    or add the widget, as central widget for QMainWindow, with setCentralWidget(QWidget*);
    Last edited by Zlatomir; 5th June 2010 at 23:13.

  3. #3
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Adding a Layout to QMainWindow

    QMainWindow needs a central widget. So you can set your layout to a QWidget, and set it as centralWidget of the QMainWindow.

Similar Threads

  1. QToolBar Layout(when part of QMainWindow)
    By iridium in forum Qt Programming
    Replies: 3
    Last Post: 18th April 2013, 13:19
  2. Problems with QMainWindow and layout
    By franco.amato in forum Qt Programming
    Replies: 2
    Last Post: 24th November 2009, 22:49
  3. Maximumsize by layout QMainWindow
    By captiva in forum Qt Programming
    Replies: 7
    Last Post: 24th February 2009, 19:41
  4. A question about adding to layout
    By Cruz in forum Qt Programming
    Replies: 1
    Last Post: 20th January 2009, 12:41
  5. Adding a QSizeGrip to a QMainWindow
    By forrestfsu in forum Qt Programming
    Replies: 6
    Last Post: 9th April 2007, 15:45

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.