Results 1 to 4 of 4

Thread: qsplitter

  1. #1
    Join Date
    Apr 2011
    Posts
    58
    Thanks
    1

    Default qsplitter

    Hi.

    When I created a vertical splitter with 5 splits.
    Everytime my mouse hover over the edge of the splits, there is change in the mouse pointer and I could adjust the size of the splits. How do I disable that? I just want fixed size and no change to the sizes.
    Another question is, when I created a button in one of the splits. the button always left align. How do I make it centre aligned? There dont seem to be a align function somewhere.

    Thanks!

  2. #2
    Join Date
    Apr 2010
    Posts
    769
    Thanks
    1
    Thanked 94 Times in 86 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: qsplitter

    The whole point of a splitter is to allow resizing. If you don't want the user to resize the layout, just use a layout that enforces the geometry you want to impose.

    While you're doing that, read up on the details of layouts, as they're the answer to your second question.

  3. #3
    Join Date
    Apr 2011
    Posts
    58
    Thanks
    1

    Default Re: qsplitter

    Thanks.

    I did this codes:
    QVBoxLayout *vBox3 = new QVBoxLayout();
    vBox3->addWidget(mywidget1);
    vBox3->addWidget(mywidget2);

    But how do I encapsulate this layout into a kind of a widget so I could add them?
    I cannot put vBox3 as the widget parameter. I tried QGroupbox and it worked.
    But I dont want QGroupBox. Is there something similar to such encapsulating function to make the vBox3 into a widget?

  4. #4
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: qsplitter

    I guess you are looking to add a layout to a widget

    Qt Code:
    1. QWidget* widget = new QWidget();
    2.  
    3. QVBoxLayout *vBox3 = new QVBoxLayout();
    4. vBox3->addWidget(mywidget1);
    5. vBox3->addWidget(mywidget2);
    6.  
    7. widget->setLayout(vBox3); // adds the layout to the widget
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Bug in QSplitter with Qt4.5.1
    By araglin in forum Qt Programming
    Replies: 1
    Last Post: 28th April 2009, 07:45
  2. QSplitter
    By weixj2003ld in forum Qt Programming
    Replies: 1
    Last Post: 8th April 2009, 13:46
  3. QSplitter in Designer
    By Boron in forum Qt Tools
    Replies: 2
    Last Post: 21st July 2008, 18:34
  4. New to QSplitter
    By bruccutler in forum Qt Programming
    Replies: 6
    Last Post: 6th September 2007, 16:43
  5. QSplitter
    By Solarity in forum Newbie
    Replies: 2
    Last Post: 10th February 2006, 17:05

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.