Skip to content
Permalink
Browse files

Notify plugins if a composer has been added or removed

git-svn-id: http://svn.osgeo.org/qgis/trunk@12372 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent
mhugent committed Dec 8, 2009
1 parent 71cf0ac commit bcb221102abdd654671120cb48c8617c7c152c46
Showing with 28 additions and 3 deletions.
  1. +8 −0 python/gui/qgisinterface.sip
  2. +2 −0 src/app/qgisapp.cpp
  3. +10 −0 src/app/qgisapp.h
  4. +2 −2 src/app/qgisappinterface.cpp
  5. +6 −1 src/gui/qgisinterface.h
@@ -246,5 +246,13 @@ class QgisInterface : QObject
*/
void currentLayerChanged ( QgsMapLayer * layer );

/**This signal is emitted when a new composer instance has been created
@note added in version 1.4*/
void composerAdded( QgsComposerView* v );

/**This signal is emitted before a new composer instance is going to be removed
@note added in version 1.4*/
void composerWillBeRemoved( QgsComposerView* v );

};

@@ -3633,11 +3633,13 @@ QgsComposer* QgisApp::createNewComposer()
//and place action into print composers menu
mPrintComposersMenu->addAction( newComposerObject->windowAction() );
newComposerObject->open();
emit composerAdded(newComposerObject->view());
return newComposerObject;
}

void QgisApp::deleteComposer( QgsComposer* c )
{
emit composerWillBeRemoved(c->view());
mPrintComposers.remove( c );
mPrintComposersMenu->removeAction( c->windowAction() );
delete c;
@@ -41,6 +41,7 @@ class QValidator;
class QgisAppInterface;
class QgsClipboard;
class QgsComposer;
class QgsComposerView;
class QgsGeometry;
class QgsHelpViewer;
class QgsFeature;
@@ -669,6 +670,15 @@ class QgisApp : public QMainWindow
*/
void currentThemeChanged( QString );

/**This signal is emitted when a new composer instance has been created
@note added in version 1.4*/
void composerAdded( QgsComposerView* v );

/**This signal is emitted before a new composer instance is going to be removed
@note added in version 1.4*/
void composerWillBeRemoved( QgsComposerView* v );


private:
/** This method will open a dialog so the user can select the sublayers
* to load
@@ -39,7 +39,8 @@ QgisAppInterface::QgisAppInterface( QgisApp * _qgis )
this, SIGNAL( currentLayerChanged( QgsMapLayer * ) ) );
connect( qgis, SIGNAL( currentThemeChanged( QString ) ),
this, SIGNAL( currentThemeChanged( QString ) ) );

connect( qgis, SIGNAL(composerAdded(QgsComposerView*)), this, SIGNAL(composerAdded( QgsComposerView* )));
connect( qgis, SIGNAL(composerWillBeRemoved(QgsComposerView*)), this, SIGNAL(composerWillBeRemoved(QgsComposerView*)));
}

QgisAppInterface::~QgisAppInterface()
@@ -211,7 +212,6 @@ bool QgisAppInterface::unregisterMainWindowAction( QAction* action )
return QgsShortcutsManager::instance()->unregisterAction( action );
}


//! Menus
QMenu *QgisAppInterface::fileMenu() { return qgis->fileMenu(); }
QMenu *QgisAppInterface::editMenu() { return qgis->editMenu(); }
@@ -292,7 +292,12 @@ class GUI_EXPORT QgisInterface : public QObject
* The pointer to layer can be null if no layer is selected
*/
void currentLayerChanged( QgsMapLayer * layer );

/**This signal is emitted when a new composer instance has been created
@note added in version 1.4*/
void composerAdded( QgsComposerView* v );
/**This signal is emitted before a new composer instance is going to be removed
@note added in version 1.4*/
void composerWillBeRemoved( QgsComposerView* v );
};

// FIXME: also in core/qgis.h

0 comments on commit bcb2211

Please sign in to comment.
You can’t perform that action at this time.