Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to control the position of QDialog?

Tags:

qt

qtgui

Is there any easy way to open the Qt dialogs in the same position as they were the last time the application was open ?
i.e. preserve position of dialogs between application sessions ?

By easy way I mean not to have manually write the window position in file, and then read :)

like image 890
user152508 Avatar asked Dec 07 '22 05:12

user152508


1 Answers

You can use the QSettings class to achieve this. It's an abstraction class that allow your applications to store its settings in order to retrieve them at next launch.

Save settings:

QSettings settings("ValueName",  "Value");

Read settings:

QString v = settings.value("ValueName");
like image 124
Patrice Bernassola Avatar answered Dec 28 '22 07:12

Patrice Bernassola