Results 1 to 3 of 3

Thread: QSplitter + multiple layouts? how?

  1. #1
    Join Date
    Nov 2008
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question QSplitter + multiple layouts? how?

    I simply want to split the window in two and use different layouts on either sides.

    I have a main window and then i split it in half with a QSplitter. How can i add widgets to the left side of the splitter with a QGridLayout and add widgets to the right side using another layout? I can't add the widgets to the QGridLayout and then add the QGridLayout to the splitter since the layout is not a widget and the splitter does not have a addWidget function... Any help would be much appreciated...

    EDIT: the splitter does have an addWidget function. but still... it doesn't solve my problem..
    Last edited by jalla2000; 6th November 2008 at 13:28. Reason: correction

  2. #2
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QSplitter + multiple layouts? how?

    simply create one wiget with a needed layout and the second one with another layout and then add these widget to a splitter using proper method (addWidget).
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  3. #3
    Join Date
    Jan 2006
    Location
    Third rock from the sun
    Posts
    106
    Thanks
    17
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QSplitter + multiple layouts? how?

    Create two QWidget as holders for the QGridLayout. Then use setLayout( ) to add the layout to the widget.

    Qt Code:
    1. QWidget *leftSide = new QWidget;
    2. QGridLayout *leftLayout = new QGridLayout;
    3. leftSide->setLayout( leftLayout );
    4. splitter->addWidget( leftSide );
    5.  
    6. // Add the remaining GUI elements to the layout and repeat for right side
    To copy to clipboard, switch view to plain text mode 

    Hope this helps.
    Every little child knows
    if you cant see dreams
    your eyes are blind

    Moxy Fruvous

  4. The following user says thank you to Rayven for this useful post:

    kja (8th September 2011)

Similar Threads

  1. how to corss compile for windows in Linux
    By safknw in forum Qt Programming
    Replies: 24
    Last Post: 13th May 2006, 05:23

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.