QStackedLayout dialog flicker
Hi,
I was trying out example about Stacked Layouts from the book "C++ GUI Programming with Qt 4, Second Edition" its Chapter 6.
Code:
PreferenceDialog
::PreferenceDialog(QWidget *parent
){
...
listWidget->addItem(tr("Appearance"));
listWidget->addItem(tr("Web Browser"));
listWidget->addItem(tr("Mail & News"));
listWidget->addItem(tr("Advanced"));
stackedLayout->addWidget(appearancePage);
stackedLayout->addWidget(webBrowserPage);
stackedLayout->addWidget(mailAndNewsPage);
stackedLayout->addWidget(advancedPage);
connect(listWidget, SIGNAL(currentRowChanged(int)),
stackedLayout, SLOT(setCurrentIndex(int)));
...
listWidget->setCurrentRow(0);
}
Code:
void MainWindow::configurationOptions()
{
PreferenceDialog *optionsDlg = new PreferenceDialog();
optionsDlg->exec();
delete optionsDlg;
}
The problem is that when I start the example I see ugly flicker on a dialog, hence my question how can this be eliminated ? I have try to use resize to make the dialog bigger by default but that didn't help.
Re: QStackedLayout dialog flicker
You'll have to define "ugly flicker" and when exactly you see it. Reizing the dialog, switching pages, as you type, one one particular page etc. Does the Config Dialog Example display similar flickering?
Re: QStackedLayout dialog flicker
sorry for not being too specific by "ugly flicker" I meant that the dialog windows shows and I can see that its being resize quickly.
Config Dialog Example works just fine.
Re: QStackedLayout dialog flicker
as an aside, please don't write code like this
Code:
void MainWindow::configurationOptions()
{
PreferenceDialog *optionsDlg = new PreferenceDialog();
optionsDlg->exec();
delete optionsDlg;
}
We are not java programmers... Instead write
Code:
void MainWindow::configurationOptions()
{
PreferenceDialog optionsDlg
optionsDlg.exec();
}
Shorter, quicker, easier to read, less prone to errors.