-
-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Save position of dockwidgets regardless of closing the application #305
base: master
Are you sure you want to change the base?
Conversation
Make it possible to save the dockwidget positions when the KImageAnnotator is destroyed as subwindow of another application before closing the application
I'm not sure if this is goring to work. I think I have tested this options to persist in the destructor but it didn't work that well. I need to do bit of testing on this PR the I'll get back to you. |
Thanks. I don't know why it won't work. I'm tested it too on kImageAnnotator-example and spectacle. I wanted to use the kImageAnnotator in the gwenview as modal dialog and faced with the fact that if I delete it before I close the application - the positions of the widgets are not saved |
I think the reason "why" it's not working in your case is that the application is Gwenview or Spectacle and you open the kImageAnnotator just as a window and close it without the main loop of qApp still running and not quitting. Can you try replacing the qApp::aboutToQuit signal with this::destroyed, like this:
Without the method call in the destructor. |
It doesn't make sense. Because I'm deleting annotation window and not deleting qApp. Signal QCoreApplication::destroyed will not be emmited. |
Sorry, my bad, I meant |
In fact this is the call of destructor. No problem, i can change to signal/slot |
I checked your version with connect. This will crash the program because the signal is emitted in the QObject's destructor when the AnnotationWidget's destructor has already completed and we cannot call its methods. But the call in the destructor of the AnnotationWidget's itself is the norm, because field mConfig is valid until the AnnotationWidget's destructor completes |
The issue with the destructor is that will only be called with a graceful shutdown, if the application finishes unexpectedly the position would not be saved. That's why it was not in initially in the destructor, it was quit the usualy use case while testing the app. Maybe this is not that big issue. |
if the application terminates unexpectedly, the signal from qApp will also not be sent and processed. In this case, there is a chance to save something only by catching the exception. But that's out of the scope of this issue. |
Make it possible to save the dockwidget positions when the
KImageAnnotator is destroyed as subwindow of another application before
closing the application