Skip to content

Commit 1fbf5ee

Browse files
author
wonder
committedOct 30, 2010
Added new project and project read signals to the qgis interface (#3160).
Contributed by Alexander Bruy - thanks! git-svn-id: http://svn.osgeo.org/qgis/trunk@14452 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 519f120 commit 1fbf5ee

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed
 

‎python/gui/qgisinterface.sip

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,5 +277,26 @@ class QgisInterface : QObject
277277
/**This signal is emitted when QGIS' initialization is complete
278278
@note added in version 1.6*/
279279
void initializationCompleted();
280+
281+
/** emitted when a project file is successfully read
282+
@note
283+
This is useful for plug-ins that store properties with project files. A
284+
plug-in can connect to this signal. When it is emitted, the plug-in
285+
knows to then check the project properties for any relevant state.
286+
287+
Added in v1.6
288+
*/
289+
void projectRead();
290+
/** emitted when starting an entirely new project
291+
@note
292+
This is similar to projectRead(); plug-ins might want to be notified
293+
that they're in a new project. Yes, projectRead() could have been
294+
overloaded to be used in the case of new projects instead. However,
295+
it's probably more semantically correct to have an entirely separate
296+
signal for when this happens.
297+
298+
Added in v1.6
299+
*/
300+
void newProjectCreated();
280301
};
281302

‎src/app/qgisappinterface.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ QgisAppInterface::QgisAppInterface( QgisApp * _qgis )
5252
this, SIGNAL( composerWillBeRemoved( QgsComposerView* ) ) );
5353
connect( qgis, SIGNAL( initializationCompleted() ),
5454
this, SIGNAL( initializationCompleted() ) );
55+
connect( qgis, SIGNAL( newProject() ),
56+
this, SIGNAL( newProjectCreated() ) );
57+
connect( qgis, SIGNAL( projectRead() ),
58+
this, SIGNAL( projectRead() ) );
5559
}
5660

5761
QgisAppInterface::~QgisAppInterface()

‎src/gui/qgisinterface.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,27 @@ class GUI_EXPORT QgisInterface : public QObject
322322
/**This signal is emitted when the initialization is complete
323323
@note added in version 1.6*/
324324
void initializationCompleted();
325+
/** emitted when a project file is successfully read
326+
@note
327+
This is useful for plug-ins that store properties with project files. A
328+
plug-in can connect to this signal. When it is emitted, the plug-in
329+
knows to then check the project properties for any relevant state.
330+
331+
Added in v1.6
332+
*/
333+
void projectRead();
334+
/** emitted when starting an entirely new project
335+
@note
336+
This is similar to projectRead(); plug-ins might want to be notified
337+
that they're in a new project. Yes, projectRead() could have been
338+
overloaded to be used in the case of new projects instead. However,
339+
it's probably more semantically correct to have an entirely separate
340+
signal for when this happens.
341+
342+
Added in v1.6
343+
*/
344+
void newProjectCreated();
345+
325346
};
326347

327348
// FIXME: also in core/qgis.h

0 commit comments

Comments
 (0)
Please sign in to comment.