Results 1 to 3 of 3

Thread: arranging objects in splitter widget

  1. #1
    Join Date
    Nov 2010
    Posts
    7
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default arranging objects in splitter widget

    hello, I want to add some pushButtons, labels and lineEdit (in other words a form!)in the chart example.
    How can I do that?

    Tried with addWidget

    splitter->addWidget(table);
    splitter->addWidget(pieChart);
    .
    .
    splitter->addWidget(mesLabel1);
    splitter->addWidget(inputBox1);

    ... but the default layout was terrible.

    also tried to create a layout and add it in the splitter
    QGridLayout *mainLayout = new QGridLayout;
    mainLayout->addWidget(mesLabel1, 0, 0);
    mainLayout->addWidget(inputBox1, 0, 1);
    .
    .
    but the addWidget() accepts only QWidget parameter

    So, how I can create a layout and add it in an (existing) QSplitter widget?

  2. #2
    Join Date
    Jan 2010
    Location
    Perth, Australia
    Posts
    37
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: arranging objects in splitter widget

    I haven't used QSplitters myself, but the documentation seems to suggest that you can't add a layout to a QSplitter. May I suggest placing multiple QSplitters in a layout? Or maybe using a QFormLayout instead?

    Edit: Another possible (but bulky) approach: Make a custom widget (e.g. call it BigWidget) that contains a label and input box in your desired layout. Then add a BigWidget into the QSplitter.
    Last edited by hackerNovitiate; 13th December 2010 at 12:39. Reason: updated contents

  3. #3
    Join Date
    Nov 2010
    Posts
    7
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: arranging objects in splitter widget


Similar Threads

  1. Replies: 2
    Last Post: 28th January 2010, 06:26
  2. Replies: 3
    Last Post: 9th January 2010, 15:47
  3. Fix size widget + Splitter
    By weepdoo in forum Qt Tools
    Replies: 0
    Last Post: 20th November 2008, 08:47
  4. Arranging the Items in Qtopia
    By sar_van81 in forum Qt for Embedded and Mobile
    Replies: 3
    Last Post: 10th December 2007, 08:52
  5. Replies: 7
    Last Post: 18th July 2006, 21:33

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
  •  
Qt is a trademark of The Qt Company.