Originally Posted by
faldżip
you can do it like this:
lo->addWidget(m_TimeDisplay);
lo->addWidget(m_WaveDisplay);
w->setLayout(lo);
sa->setWidget(w);
QWidget w = new QWidget(this);
QVBoxLayout *lo = new QVBoxLayout;
lo->addWidget(m_TimeDisplay);
lo->addWidget(m_WaveDisplay);
w->setLayout(lo);
sa->setWidget(w);
To copy to clipboard, switch view to plain text mode
I spoken too early.
It doesn't work.
In the ctor of the m_TimeDisplay I have
setMinimumSize
( QSize(800,
20) );
setMinimumSize( QSize(800, 20) );
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); // it must expand only orizzontally
To copy to clipboard, switch view to plain text mode
In the ctor of the m_WaveDisplay I have
setMinimumSize
( QSize(800,
250) );
setMinimumSize( QSize(800, 250) );
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); // it must expand only orizzontally
To copy to clipboard, switch view to plain text mode
Now in the ctor of the WaveWidget that must contains both m_TimeDisplay and m_WaveDisplay
I have the code you suggested to me:
/* scroll area */
sa->setWidgetResizable( true );
sa->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
sa->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOn );
QScrollBar *scrollBar
= sa
->horizontalScrollBar
();
w->setMinimumSize(800, 271); // 271 = 250(m_WaveDisplay) + 20(m_TimeDisplay) + 1
il->addWidget( m_TimeDisplay );
il->addWidget( m_WaveDisplay );
w->setLayout(il);
sa->setWidget(w);
layout->addWidget(sa);
layout->addLayout( infoLayout );
layout->addLayout(lo);
setLayout(layout);
/* scroll area */
QScrollArea* sa = new QScrollArea( this );
sa->setWidgetResizable( true );
sa->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
sa->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOn );
QScrollBar *scrollBar = sa->horizontalScrollBar();
QWidget* w = new QWidget();
w->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
w->setMinimumSize(800, 271); // 271 = 250(m_WaveDisplay) + 20(m_TimeDisplay) + 1
QVBoxLayout* il = new QVBoxLayout;
il->addWidget( m_TimeDisplay );
il->addWidget( m_WaveDisplay );
w->setLayout(il);
sa->setWidget(w);
QVBoxLayout* layout = new QVBoxLayout();
layout->addWidget(sa);
layout->addLayout( infoLayout );
layout->addLayout(lo);
setLayout(layout);
To copy to clipboard, switch view to plain text mode
The result is in this image ( also attached )image.jpg
You can see that there are some not desired spaces and the widget w doesn't occupies all scrollarea surface.
I don't know where I'm wrong.
Best Regards,
Franco
Bookmarks