Results 1 to 2 of 2

Thread: Splitter doubt, want a minimal space for the left widget.

  1. #1
    Join Date
    Sep 2010
    Posts
    654
    Thanks
    56
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Splitter doubt, want a minimal space for the left widget.

    I have 2 frames arranged by a splitter.
    I'd want 200 px min for frame1 (the left).
    Sincerely I dont know what policy to apply ( nothing works)
    Any help would be appreciated

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Splitter doubt, want a minimal space for the left widget.

    Set the QWidget::sizePolicy() of the left widget to QSizePolicy::MinimumExpanding for horizontal, and its minimum width to 200 QWidget::setMinimumWidth()
    Qt Code:
    1. class MainWindow: public QMainWindow {
    2. Q_OBJECT
    3. public:
    4. MainWindow(QWidget *p = 0): QMainWindow(p) {
    5. QSplitter *splitter = new QSplitter(this);
    6. QTextEdit *left = new QTextEdit(this);
    7. left->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
    8. left->setMinimumWidth(200);
    9. QTextEdit *right = new QTextEdit(this);
    10. splitter->addWidget(left);
    11. splitter->addWidget(right);
    12.  
    13. setCentralWidget(splitter);
    14. }
    15. public slots:
    16. private:
    17. };
    To copy to clipboard, switch view to plain text mode 
    Last edited by ChrisW67; 24th July 2011 at 01:59.

Similar Threads

  1. arranging objects in splitter widget
    By bigbill in forum Newbie
    Replies: 2
    Last Post: 13th December 2010, 12:33
  2. How to override system shortcut left Alt+Space
    By MasterBLB in forum Qt Programming
    Replies: 2
    Last Post: 28th March 2010, 11:28
  3. Fix size widget + Splitter
    By weepdoo in forum Qt Tools
    Replies: 0
    Last Post: 20th November 2008, 08:47
  4. Keeping the left side of a splitter from resizing
    By MrGarbage in forum Qt Programming
    Replies: 3
    Last Post: 14th December 2007, 19:50
  5. space left command?
    By mhoover in forum General Discussion
    Replies: 1
    Last Post: 27th July 2006, 03:34

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.