Skip to content

Commit

Permalink
Added new project and project read signals to the qgis interface (#3160
Browse files Browse the repository at this point in the history
…).

Contributed by Alexander Bruy - thanks!


git-svn-id: http://svn.osgeo.org/qgis/trunk@14452 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder committed Oct 30, 2010
1 parent 519f120 commit 1fbf5ee
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
21 changes: 21 additions & 0 deletions python/gui/qgisinterface.sip
Expand Up @@ -277,5 +277,26 @@ class QgisInterface : QObject
/**This signal is emitted when QGIS' initialization is complete
@note added in version 1.6*/
void initializationCompleted();

/** emitted when a project file is successfully read
@note
This is useful for plug-ins that store properties with project files. A
plug-in can connect to this signal. When it is emitted, the plug-in
knows to then check the project properties for any relevant state.

Added in v1.6
*/
void projectRead();
/** emitted when starting an entirely new project
@note
This is similar to projectRead(); plug-ins might want to be notified
that they're in a new project. Yes, projectRead() could have been
overloaded to be used in the case of new projects instead. However,
it's probably more semantically correct to have an entirely separate
signal for when this happens.

Added in v1.6
*/
void newProjectCreated();
};

4 changes: 4 additions & 0 deletions src/app/qgisappinterface.cpp
Expand Up @@ -52,6 +52,10 @@ QgisAppInterface::QgisAppInterface( QgisApp * _qgis )
this, SIGNAL( composerWillBeRemoved( QgsComposerView* ) ) );
connect( qgis, SIGNAL( initializationCompleted() ),
this, SIGNAL( initializationCompleted() ) );
connect( qgis, SIGNAL( newProject() ),
this, SIGNAL( newProjectCreated() ) );
connect( qgis, SIGNAL( projectRead() ),
this, SIGNAL( projectRead() ) );
}

QgisAppInterface::~QgisAppInterface()
Expand Down
21 changes: 21 additions & 0 deletions src/gui/qgisinterface.h
Expand Up @@ -322,6 +322,27 @@ class GUI_EXPORT QgisInterface : public QObject
/**This signal is emitted when the initialization is complete
@note added in version 1.6*/
void initializationCompleted();
/** emitted when a project file is successfully read
@note
This is useful for plug-ins that store properties with project files. A
plug-in can connect to this signal. When it is emitted, the plug-in
knows to then check the project properties for any relevant state.
Added in v1.6
*/
void projectRead();
/** emitted when starting an entirely new project
@note
This is similar to projectRead(); plug-ins might want to be notified
that they're in a new project. Yes, projectRead() could have been
overloaded to be used in the case of new projects instead. However,
it's probably more semantically correct to have an entirely separate
signal for when this happens.
Added in v1.6
*/
void newProjectCreated();

};

// FIXME: also in core/qgis.h
Expand Down

0 comments on commit 1fbf5ee

Please sign in to comment.