Results 1 to 2 of 2

Thread: QVBOxLayout problem with QSCrollArea and QWidget

  1. #1
    Join Date
    Feb 2009
    Posts
    189
    Thanks
    2

    Default QVBOxLayout problem with QSCrollArea and QWidget

    Dear Friends

    I have three widgets as below.

    Qt Code:
    1. void MainWindow::Somefunc()
    2. {
    3. CHeadWidget * header = new CHeadWidget(this,showcasepage);
    4. PageForGraph *plotpage = new PageForGraph(this,showcasepage);
    5.  
    6. QWidget * showcasepage = new QWidget(this);
    7. QVBoxLayout *layout = new QVBoxLayout;
    8. layout->setDirection(QBoxLayout::TopToBottom);
    9. layout->addWidget(header);
    10. layout->addWidget(plotpage);
    11. layout->setContentsMargins(0, 0, 0, 0);
    12. layout->setSpacing(0);
    13.  
    14.  
    15. showcasepage->setLayout(layout);
    16.  
    17. center->addWidget(showcasepage);
    18. center->setCurrentWidget(showcasepage);
    19. }
    20. /////////////////////////////////////////////////////////////////
    To copy to clipboard, switch view to plain text mode 
    But with this I cannot see the header at the top. I can only see the plotpage. Any help would be appreciated. Thanks sujan
    Last edited by high_flyer; 16th March 2011 at 09:40. Reason: code tags

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QVBOxLayout problem with QSCrollArea and QWidget

    This code should not even compile!
    You are giving 'showcasepage' as parameter before it is declared!
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

Similar Threads

  1. Problem with QHBoxlayout & QVBoxlayout
    By phillip_Qt in forum Qt Tools
    Replies: 5
    Last Post: 13th January 2009, 10:26
  2. QVBoxLayout and QHBoxLayout problem
    By fmariusd in forum Qt Programming
    Replies: 2
    Last Post: 10th January 2009, 20:58
  3. Dynamic updates of a QWidget in a QScrollArea
    By plamkata in forum Qt Programming
    Replies: 2
    Last Post: 20th July 2008, 23:45
  4. size issues for custom QWidget in QScrollArea
    By anotheruser in forum Qt Programming
    Replies: 1
    Last Post: 27th April 2006, 14:52
  5. QScrollArea problem positioning a QWidget inside
    By Spectator in forum Qt Programming
    Replies: 4
    Last Post: 20th February 2006, 22:59

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.