Results 1 to 3 of 3

Thread: Why doesnt my QGridLayout resize?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2009
    Posts
    45
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    1

    Default Why doesnt my QGridLayout resize?

    This resizes perfectly ------
    Qt Code:
    1. QGridLayout *layout = new QGridLayout(this);
    2. layout->setSpacing(6);
    3. layout->setMargin(11);
    4. QPlainTextEdit* mybox = new QPlainTextEdit(this);
    5. layout->addWidget(mybox, 0, 0, 1, 2);
    6. setLayout(layout);
    To copy to clipboard, switch view to plain text mode 

    This doesnt resize at all ------
    Qt Code:
    1. QWidget* widget = new QWidget(this)
    2. QGridLayout *layout = new QGridLayout(widget);
    3. layout->setSpacing(6);
    4. layout->setMargin(11);
    5. QPlainTextEdit* mybox = new QPlainTextEdit(this);
    6. layout->addWidget(mybox, 0, 0, 1, 2);
    7. setLayout(layout);
    To copy to clipboard, switch view to plain text mode 

    The only difference is with the 2nd example, im creating a widget* and making the layout a child of that widget which is what Qt Designer does.. How can I make this resize work using the 2nd example?
    Last edited by jpn; 20th January 2009 at 07:16. Reason: missing [code] tags

Similar Threads

  1. Replies: 2
    Last Post: 22nd January 2008, 16:10
  2. QGraphicsScene / QGraphicsView speed after resize
    By themolecule in forum Qt Programming
    Replies: 1
    Last Post: 21st July 2007, 23:46
  3. Qt 3.3 QGridLayout
    By ToddAtWSU in forum Qt Programming
    Replies: 2
    Last Post: 23rd February 2007, 17:40
  4. Custom Shape Widget (resize)
    By PiXeL16 in forum Qt Programming
    Replies: 7
    Last Post: 12th February 2007, 07:00
  5. postponing resize event
    By Honestmath in forum Qt Programming
    Replies: 11
    Last Post: 26th February 2006, 00:32

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.