Re: QScrollArea confusion
Code:
#include <QtGui>
{
Q_OBJECT
public:
{
connect(&m_timer, SIGNAL(timeout()), this, SLOT(onTimeout()));
m_timer.start(1000);
}
private:
private slots:
void onTimeout()
{
static int counter = 0;
qDebug() << Q_FUNC_INFO << counter;
m_layout->addWidget(label);
label->show();
adjustSize();
}
};
int main(int argc, char** argv)
{
scrollArea.setWidget(new Container(&scrollArea));
scrollArea.show();
return app.exec();
}
#include "scrollareatest.moc"
Cheers,
_
Re: QScrollArea confusion
Thanks a lot for responding, The example was helpful, in that it encouraged me to try the 'adjustSize()' function.
This finally caused the widgets within my list to be displayed.
Basically after I add a widget to the list of widgets, I need to call the adjustSize() function to get the list widget to resize itself and become visible.
However I'm still confused why the default behavior while set as the central widget for a QMainWindow didn't require me to call adjustSize(). It seems odd to me that the two should behave differently.
Re: QScrollArea confusion
In the case of being a QMainWindow central widget, the container is part of a layout, the QMainWindow layout. In the QScrollArea case it is not and it is neither a top level window (which would resize itself).
Cheers,
_