Registered Member
|
Hello everybody, same as subject, how can I get my application to save and restore basic configuration (such as state of some toggle action, recent files and similar)?
My main window class inherits from KXmlGuiWindow. Thanks! |
Administrator
|
You need to look at KConfig for this.
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
Registered Member
|
Thanks a lot, it worked!
|
Registered Member
|
Why if I put a function that prompts the user the choice to save file or cancel exiting in queryExit function (overridden from KXmlGuiWindow) and I return false to queryExit (i.e. the Cancel button) the program closes in any case?
With the queryClose it doesn't happen, and the code in both functions it's the same... |
Administrator
|
It may be, that if all windows are closed your application is automatically quit.
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
Registered Member
|
In fact it is, but I looked at KMainWindow documentation, in the queryExit function:
So if I type CTRL + Q or if I choose "Quit" from the file menu and then "Cancel" to the dialog, it should'n exit the application There's another interesting thing in queryExit explanation:
So if the user quit the application by using "Quit", there shouldn't be any interaction or prompt whether to save changes or not? That point isn't clear for me... |
Administrator
|
If "Quit" is pressed then the main application should try to close all windows, and if any fail, then it should not continue.
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
Registered Member
|
Mmm... So if I return false from queryQuit, it should not continue closing the application, right?
|
Administrator
|
Correct, however all your windows may be closed at this point, so the application will be closed anyway. You should do the check in queryClose as recommended by the documentation.
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
Registered Member
|
Registered users: Bing [Bot], Evergrowing, Google [Bot], rockscient