Skip to content

Commit

Permalink
Notify plugins about composer addition / deletion also when loading a…
Browse files Browse the repository at this point in the history
… 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 60fda2a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/app/composer/qgscomposer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -959,6 +959,8 @@ void QgsComposer::on_mActionLoadFromTemplate_triggered()
return;
}

emit composerWillBeRemoved( mView );

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

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

void QgsComposer::on_mActionMoveItemContent_triggered()
Expand Down
4 changes: 4 additions & 0 deletions src/app/composer/qgscomposer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 60fda2a

Please sign in to comment.