[Interest] Interest Digest, Vol 18, Issue 51
Etienne Sandré-Chardonnal
etienne.sandre at m4x.org
Wed Mar 20 17:40:57 CET 2013
> Use a boolean to only restore on the first call to showEvent ?
I will do this... I just wanted to avoid adding much of these
variables, as the class is becoming larger and larger...
>
> Post some code showing where you are using it in the constructor?
>
> I use it in mine and it works fine.
That's what I am doing currently, I stripped out other stuff in the
class initialization:
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
m_ui(new Ui::MainWindow),
{
m_ui->setupUi(this);
QSettings settings;
if(settings.contains("mainwindow/geometry"))
restoreGeometry(settings.value("mainwindow/geometry").toByteArray());
if(settings.contains("mainwindow/state"))
{
restoreState(settings.value("mainwindow/state").toByteArray());
}
}
> > I want to use QMainWindow::restoreState for restoring window dock widgets.
> > saveState works well in closeEvent (I have some data in the registry wrote with
> > QSettings).
> >
> > restoreState does not work when called from the constructor (nothing is restored)
> > I have googled for this, most people put it in showEvent. But showEvent is
> > called also when the window gets restored after being minimized, the docks
> > should not be restored then!
More information about the Interest
mailing list