Hi All,
hope you can help me out with this. I'm trying to save my window setting using the code below ( from a you tube tutorial). However whatever I try when I save the window and try to load it it's tiny. So to save I use
void MainWindow::GUI_savesettings( void )
{
settings.beginGroup("MainWindow");
settings.setValue( "position", this->geometry( ) );
settings.endGroup();
qDebug()<<"save";
}
void MainWindow::GUI_savesettings( void )
{
QSettings settings("mysoft", "test");
settings.beginGroup("MainWindow");
settings.setValue( "position", this->geometry( ) );
settings.endGroup();
qDebug()<<"save";
}
To copy to clipboard, switch view to plain text mode
and to load
void MainWindow::GUI_loadsettings( void )
{
settings.beginGroup("MainWindow");
QRect myrect
= settings.
value( "position " ).
toRect();
setGeometry( myrect );
settings.endGroup();
}
void MainWindow::GUI_loadsettings( void )
{
QSettings settings("mysoft", "test");
settings.beginGroup("MainWindow");
QRect myrect = settings.value( "position " ).toRect();
setGeometry( myrect );
settings.endGroup();
}
To copy to clipboard, switch view to plain text mode
When I debug I can set that in my load function myrect is set to postion,sizes 0,0,0,0.
I'm running Linux Lubuntu, could this be the cause? Or is there some error in my code? Or some mod to the way Qt handles this, I'm using 5.0.17
Thanks in advance.
Added after 23 minutes:
SOLVED
I copied the tutorial from http://contingencycoder.wordpress.co...ometry-part-2/
This works great
Bookmarks