Skip to content
Permalink
Browse files
Notify plugins about composer addition / deletion also when loading a…
… composer template

git-svn-id: http://svn.osgeo.org/qgis/trunk@14909 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Dec 14, 2010
1 parent f117323 commit 60fda2ab11f63e809210d66185caf7fc07ff036c
Showing with 13 additions and 1 deletion.
  1. +3 −0 src/app/composer/qgscomposer.cpp
  2. +4 −0 src/app/composer/qgscomposer.h
  3. +6 −1 src/app/qgisapp.cpp
@@ -959,6 +959,8 @@ void QgsComposer::on_mActionLoadFromTemplate_triggered()
return;
}

emit composerWillBeRemoved( mView );

QDomDocument templateDocument;
if ( !templateDocument.setContent( &templateFile, false ) )
{
@@ -968,6 +970,7 @@ void QgsComposer::on_mActionLoadFromTemplate_triggered()

deleteItems();
readXML( templateDocument );
emit composerAdded( mView );
}

void QgsComposer::on_mActionMoveItemContent_triggered()
@@ -103,6 +103,10 @@ class QgsComposer: public QMainWindow, private Ui::QgsComposerBase
//! Is emitted every time the view zoom has changed
void zoomLevelChanged();

void composerAdded( QgsComposerView* v );
//!Composer deletes the old composerview when loading a template
void composerWillBeRemoved( QgsComposerView* v );


public slots:
//! Zoom to full extent of the paper
@@ -903,7 +903,7 @@ void QgisApp::createActions()
mActionSelect->setEnabled( false );

QString selectOptionTip( tr( ", hold shift to select by containment" ) + singleSelectOptTip );

mActionSelectRectangle = new QAction( getThemeIcon( "mActionSelectRectangle.png" ), tr( "Select features by rectangle" ), this );
shortcuts->registerAction( mActionSelectRectangle );
mActionSelectRectangle->setStatusTip( tr( "Select features by rectangle" ) + selectOptionTip );
@@ -4220,12 +4220,15 @@ QgsComposer* QgisApp::createNewComposer()
mLastComposerId++;
//create new composer object
QgsComposer* newComposerObject = new QgsComposer( this, tr( "Composer %1" ).arg( mLastComposerId ) );

//add it to the map of existing print composers
mPrintComposers.insert( newComposerObject );
//and place action into print composers menu
mPrintComposersMenu->addAction( newComposerObject->windowAction() );
newComposerObject->open();
emit composerAdded( newComposerObject->view() );
connect( newComposerObject, SIGNAL( composerAdded( QgsComposerView* ) ), this, SIGNAL( composerAdded( QgsComposerView* ) ) );
connect( newComposerObject, SIGNAL( composerWillBeRemoved( QgsComposerView* ) ), this, SIGNAL( composerWillBeRemoved( QgsComposerView* ) ) );
return newComposerObject;
}

@@ -4262,6 +4265,8 @@ bool QgisApp::loadComposersFromProject( const QDomDocument& doc )
composer->close();
}
emit composerAdded( composer->view() );
connect( composer, SIGNAL( composerAdded( QgsComposerView* ) ), this, SIGNAL( composerAdded( QgsComposerView* ) ) );
connect( composer, SIGNAL( composerWillBeRemoved( QgsComposerView* ) ), this, SIGNAL( composerWillBeRemoved( QgsComposerView* ) ) );
}
return true;
}

0 comments on commit 60fda2a

Please sign in to comment.