Results 1 to 3 of 3

Thread: Problems with QMainWindow and layout

  1. #1
    Join Date
    Nov 2007
    Location
    Italy
    Posts
    693
    Thanks
    59
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Problems with QMainWindow and layout

    Hi to all,
    I have a QMainWindow, a central widget ( as wanted by Qt ) and I would layout it.
    In the centralWidget I would put vertically:
    1 QScrollArea containing 1 custom widgets
    1 QScrollArea containing 1 custom widgets
    other controls.

    I tried with a QVBoxLayout but I have problems with the scrollarea and the custom widget.

    Can I have a help?

    Best Regards,
    Franco
    Franco Amato

  2. #2
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 163 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Problems with QMainWindow and layout

    describe those problems, please...

  3. #3
    Join Date
    Nov 2007
    Location
    Italy
    Posts
    693
    Thanks
    59
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problems with QMainWindow and layout

    Quote Originally Posted by caduel View Post
    describe those problems, please...
    Dear Caduel,
    the problem is that I can not see the custom widget. Is not displayed.
    Here come code:

    Qt Code:
    1. CentralWidget::CentralWidget( QWidget* parent /* = 0 */ )
    2. : QWidget(parent),
    3. mp_vBox( 0 ),
    4. mp_wave( 0 )
    5. {
    6. /* vertical laayout */
    7. mp_vBox = new QVBoxLayout( this );
    8. /* scroll area */
    9. scrollArea = new QScrollArea();
    10. /* waveform ( my custom widget ) */
    11. mp_wave = new WaveWidget( this );
    12. scrollArea->setWidget(mp_wave);
    13. mp_vBox->addWidget( scrollArea );
    14. ..I would add another scrollArea
    15. ..with another WaveWidget
    16. ...and more controls ( buttons, etc )
    17. setLayout(mp_vBox);
    18. }
    To copy to clipboard, switch view to plain text mode 

    I don't know where the code is wrong, but I can not see the WaveWidget.
    The WaveWidget expand in the x direction so I need a scrollArea
    Best,
    Franco
    Franco Amato

Similar Threads

  1. QMainWindow as a child of QMainWindow
    By Elder Orb in forum Qt Programming
    Replies: 8
    Last Post: 12th February 2011, 21:31
  2. QMainWindow : restorestate problems
    By fmariusd in forum Qt Programming
    Replies: 10
    Last Post: 30th October 2009, 08:05
  3. layout direction issues with QGraphicsScene
    By sanjayshelke in forum Qt Programming
    Replies: 2
    Last Post: 16th June 2009, 23:23
  4. Maximumsize by layout QMainWindow
    By captiva in forum Qt Programming
    Replies: 7
    Last Post: 24th February 2009, 19:41
  5. Nested Layout
    By starcontrol in forum Qt Programming
    Replies: 2
    Last Post: 9th April 2008, 12:47

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.