PDA

View Full Version : Problems with QMainWindow and layout



franco.amato
24th November 2009, 20:53
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

caduel
24th November 2009, 21:49
describe those problems, please...

franco.amato
24th November 2009, 23:49
describe those problems, please...

Dear Caduel,
the problem is that I can not see the custom widget. Is not displayed.
Here come code:


CentralWidget::CentralWidget( QWidget* parent /* = 0 */ )
: QWidget(parent),
mp_vBox( 0 ),
mp_wave( 0 )
{
/* vertical laayout */
mp_vBox = new QVBoxLayout( this );
/* scroll area */
scrollArea = new QScrollArea();
/* waveform ( my custom widget ) */
mp_wave = new WaveWidget( this );
scrollArea->setWidget(mp_wave);
mp_vBox->addWidget( scrollArea );
..I would add another scrollArea
..with another WaveWidget
...and more controls ( buttons, etc )
setLayout(mp_vBox);
}

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