I think I might know what's going wrong.
So you construct an object of MainWindow,in the constructor,you call GetWindowsSettings() to set its geometry thing.
After the construction you also call
win.setGeometery(0, 0, 800, 600);
win.setGeometery(0, 0, 800, 600);
To copy to clipboard, switch view to plain text mode
so,setGeometery() overrides GetWindowsSettings() which makes GetWindowsSettings() useless.
Perhaps you want to make sure it's 800*600 when the app first run.
void MainWindow::GetWindowSettings()
{
settings.beginGroup("MainWindow");
resize
(settings.
value("size",
QSize(800,
600)).
toSize());
move
(settings.
value("pos",
QPoint(5,
30)).
toPoint());
settings.endGroup();
}
void MainWindow::GetWindowSettings()
{
QSettings settings("C:/temp/temp.ini", QSettings::IniFormat);
settings.beginGroup("MainWindow");
resize(settings.value("size", QSize(800, 600)).toSize());
move(settings.value("pos", QPoint(5, 30)).toPoint());
settings.endGroup();
}
To copy to clipboard, switch view to plain text mode
In GetWindowSettings(),you have already provided a default value.If the app cannot find the temp.ini.It will resize to 800*600.So,actually you don't have to call setGeometery().
Bookmarks