Results 1 to 2 of 2

Thread: Problem in setting gridlayout.

  1. #1
    Join Date
    May 2011
    Posts
    120
    Thanks
    9
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Problem in setting gridlayout.

    Hi
    i am setting a gridlayout in frame which is child class of MainWindow , but the widget which i set on layout are not gett display.Where i am wrong.My code is

    Qt Code:
    1. NewWindow::NewWindow(QWidget *parent) :
    2. QMainWindow(parent),
    3. ui(new Ui::NewWindow)
    4. {
    5. ui->setupUi(this);
    6. this->setStyleSheet("background-color:gray");
    7. QString string = "Home profile";
    8. w1 = new MainWindow(string ,this);//Custom Buttons object
    9. QString string1 = "Emergency Help";
    10. w2 = new MainWindow(string1 ,this);//Custom Buttons object
    11. QFrame *centralFrame=new QFrame(this);
    12. centralFrame->setStyleSheet("background-color:blue");
    13. this->setCentralWidget(centralFrame);
    14. QGridLayout *layout= new QGridLayout(centralFrame);
    15. layout->addWidget( w1,0,0);
    16. layout->addWidget( w2,1,1);
    17. centralFrame->setLayout(layout);
    18. centralFrame->setGeometry(160,180,400,200);
    19. }
    To copy to clipboard, switch view to plain text mode 
    ]

    Thanks
    Waiting for your reply.

  2. #2
    Join Date
    Nov 2010
    Posts
    315
    Thanked 53 Times in 51 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Problem in setting gridlayout.

    You have attached centralFrame to NewWindow. So if NewWindow is smaller then about 160x180 then frame is out of view.

    PS. Strange solution: MainWindow used as a child for other window/widget and managed by layout.

Similar Threads

  1. How to clear the GridLayout
    By rahulgogoi in forum Qt Programming
    Replies: 7
    Last Post: 13th May 2011, 06:22
  2. Replies: 1
    Last Post: 3rd November 2010, 12:06
  3. Widget layout in GridLayout
    By Dato0011 in forum Qt Programming
    Replies: 8
    Last Post: 7th December 2009, 09:26
  4. QMdiArea with Gridlayout
    By ericV in forum Qt Programming
    Replies: 0
    Last Post: 14th September 2009, 11:26
  5. does gridlayout really lay out?
    By illuzioner in forum Newbie
    Replies: 2
    Last Post: 26th February 2006, 00:57

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.