Feature request #3297
Add projectSaved() signal to the QgisInterface
Status: | Closed | ||
---|---|---|---|
Priority: | Low | ||
Assignee: | nobody - | ||
Category: | Project Loading/Saving | ||
Pull Request or Patch supplied: | Resolution: | worksforme | |
Easy fix?: | No | Copied to github as #: | 13357 |
Description
Creates a projectSaved() signal that can be used by plugins to take actions when a project is saved.
This matches the projectRead() signal emitted when a project is read, allowing a plugin to carry out corresponding activities when a project is saved and read.
History
#1 Updated by Chris Crook almost 14 years ago
Patch attached
#2 Updated by Martin Dobias almost 14 years ago
The patch looks OK, but I'm wondering whether the plugins wouldn't profit more from a signal e.g. "projectWillBeSaved" which would be called before saving the project file, so that plugins could alter the project file somehow (given they receive project's QDomDocument with the signal).
#3 Updated by Chris Crook almost 14 years ago
In this case I'm thinking that I need a signal after the project is successfully saved. I'm not doing anything with the DOM, I'm saving other data external to the project file. I want to be sure that the project file is successfully saved (and the filename is defined), before I do this.
I agree that a projectWillBeSaved(QDom), or maybe savingProject(QDom), would also be a useful signal.
#4 Updated by Jürgen Fischer almost 14 years ago
Am I missing something? Shouldn't connecting to QgsProject.writeProject( QDomDocument & ) (possibly in a projectRead() slot) already work?
#5 Updated by Chris Crook almost 14 years ago
- Resolution set to worksforme
- Status changed from Open to Closed
Good point .. it does indeed seem to work.
I hadn't realised that the QgsProject was a singleton, so I can just attach to the .instance() signals. Although the timing of the event doesn't fit perfectly (the file is not completely written) I think this is works for me!
It may be worth putting a bit more source code documentation on the QgsInterface readProject signal to point users to the QgsProject signals?