[QGIS Commit] r9064 -
branches/advanced_printing_branch/src/app/composer
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Sat Aug 16 07:39:44 EDT 2008
Author: mhugent
Date: 2008-08-16 07:39:43 -0400 (Sat, 16 Aug 2008)
New Revision: 9064
Modified:
branches/advanced_printing_branch/src/app/composer/qgscomposer.cpp
branches/advanced_printing_branch/src/app/composer/qgscomposer.h
branches/advanced_printing_branch/src/app/composer/qgscomposerview.cpp
branches/advanced_printing_branch/src/app/composer/qgscomposerview.h
Log:
Automatically set selection tool in composer after creating an new composer element
Modified: branches/advanced_printing_branch/src/app/composer/qgscomposer.cpp
===================================================================
--- branches/advanced_printing_branch/src/app/composer/qgscomposer.cpp 2008-08-16 09:56:51 UTC (rev 9063)
+++ branches/advanced_printing_branch/src/app/composer/qgscomposer.cpp 2008-08-16 11:39:43 UTC (rev 9064)
@@ -113,13 +113,7 @@
//create composer view
mView = new QgsComposerView (mViewFrame);
- connect(mView, SIGNAL(selectedItemChanged(const QgsComposerItem*)), this, SLOT(showItemOptions(const QgsComposerItem*)));
- connect(mView, SIGNAL(composerLabelAdded(QgsComposerLabel*)), this, SLOT(addComposerLabel(QgsComposerLabel*)));
- connect(mView, SIGNAL(composerMapAdded(QgsComposerMap*)), this, SLOT(addComposerMap(QgsComposerMap*)));
- connect(mView, SIGNAL(itemRemoved(QgsComposerItem*)), this, SLOT(deleteItem(QgsComposerItem*)));
- connect(mView, SIGNAL(composerScaleBarAdded(QgsComposerScaleBar*)), this, SLOT(addComposerScaleBar(QgsComposerScaleBar*)));
- connect(mView, SIGNAL(composerLegendAdded(QgsComposerLegend*)), this, SLOT(addComposerLegend(QgsComposerLegend*)));
- connect(mView, SIGNAL(composerPictureAdded(QgsComposerPicture*)), this, SLOT(addComposerPicture(QgsComposerPicture*)));
+ connectSlots();
mComposition = new QgsComposition(mQgis->getMapCanvas());
mView->setComposition(mComposition);
@@ -188,6 +182,18 @@
mActionSelectMoveItem->setIcon(QIcon(QPixmap(myThemePath + "/mActionPan.png")));
}
+void QgsComposer::connectSlots()
+{
+ connect(mView, SIGNAL(selectedItemChanged(const QgsComposerItem*)), this, SLOT(showItemOptions(const QgsComposerItem*)));
+ connect(mView, SIGNAL(composerLabelAdded(QgsComposerLabel*)), this, SLOT(addComposerLabel(QgsComposerLabel*)));
+ connect(mView, SIGNAL(composerMapAdded(QgsComposerMap*)), this, SLOT(addComposerMap(QgsComposerMap*)));
+ connect(mView, SIGNAL(itemRemoved(QgsComposerItem*)), this, SLOT(deleteItem(QgsComposerItem*)));
+ connect(mView, SIGNAL(composerScaleBarAdded(QgsComposerScaleBar*)), this, SLOT(addComposerScaleBar(QgsComposerScaleBar*)));
+ connect(mView, SIGNAL(composerLegendAdded(QgsComposerLegend*)), this, SLOT(addComposerLegend(QgsComposerLegend*)));
+ connect(mView, SIGNAL(composerPictureAdded(QgsComposerPicture*)), this, SLOT(addComposerPicture(QgsComposerPicture*)));
+ connect(mView, SIGNAL(actionFinished()), this, SLOT(setSelectionTool()));
+}
+
void QgsComposer::open ( void )
{
if ( mFirstTime ) {
@@ -1204,13 +1210,8 @@
//todo: move in function because duplicated code with constructor
mView = new QgsComposerView(mViewFrame);
- connect(mView, SIGNAL(selectedItemChanged(const QgsComposerItem*)), this, SLOT(showItemOptions(const QgsComposerItem*)));
- connect(mView, SIGNAL(composerLabelAdded(QgsComposerLabel*)), this, SLOT(addComposerLabel(QgsComposerLabel*)));
- connect(mView, SIGNAL(composerMapAdded(QgsComposerMap*)), this, SLOT(addComposerMap(QgsComposerMap*)));
- connect(mView, SIGNAL(itemRemoved(QgsComposerItem*)), this, SLOT(deleteItem(QgsComposerItem*)));
- connect(mView, SIGNAL(composerScaleBarAdded(QgsComposerScaleBar*)), this, SLOT(addComposerScaleBar(QgsComposerScaleBar*)));
- connect(mView, SIGNAL(composerLegendAdded(QgsComposerLegend*)), this, SLOT(addComposerLegend(QgsComposerLegend*)));
-
+ connectSlots();
+
mComposition = new QgsComposition(mQgis->getMapCanvas());
mComposition->readXML(compositionElem, doc);
@@ -1362,4 +1363,5 @@
void QgsComposer::setSelectionTool()
{
mActionSelectMoveItem->setChecked(true);
+ on_mActionSelectMoveItem_activated();
}
Modified: branches/advanced_printing_branch/src/app/composer/qgscomposer.h
===================================================================
--- branches/advanced_printing_branch/src/app/composer/qgscomposer.h 2008-08-16 09:56:51 UTC (rev 9063)
+++ branches/advanced_printing_branch/src/app/composer/qgscomposer.h 2008-08-16 11:39:43 UTC (rev 9064)
@@ -197,6 +197,8 @@
private:
//! Set teh pixmap / icons on the toolbar buttons
void setupTheme();
+ /**Etablishes the signal slot connection for the class*/
+ void connectSlots();
#if 0
/** \brief move up the content of the file
Modified: branches/advanced_printing_branch/src/app/composer/qgscomposerview.cpp
===================================================================
--- branches/advanced_printing_branch/src/app/composer/qgscomposerview.cpp 2008-08-16 09:56:51 UTC (rev 9063)
+++ branches/advanced_printing_branch/src/app/composer/qgscomposerview.cpp 2008-08-16 11:39:43 UTC (rev 9064)
@@ -104,6 +104,7 @@
newLabelItem->setZValue(60);
newLabelItem->setSelected(true);
emit selectedItemChanged(newLabelItem);
+ emit actionFinished();
}
break;
@@ -126,6 +127,7 @@
newScaleBar->setZValue(60);
newScaleBar->setSelected(true);
emit selectedItemChanged(newScaleBar);
+ emit actionFinished();
}
break;
@@ -139,6 +141,7 @@
newLegend->setSceneRect(QRectF(scenePoint.x(), scenePoint.y(), newLegend->rect().width(), newLegend->rect().height()));
newLegend->setSelected(true);
emit selectedItemChanged(newLegend);
+ emit actionFinished();
break;
}
case AddPicture:
@@ -151,6 +154,7 @@
newPicture->setSceneRect(QRectF(scenePoint.x(), scenePoint.y(), 30, 30));
newPicture->setSelected(true);
emit selectedItemChanged(newPicture);
+ emit actionFinished();
}
default:
@@ -218,6 +222,7 @@
composerMap->setSelected(true);
emit selectedItemChanged(composerMap);
+ emit actionFinished();
}
break;
Modified: branches/advanced_printing_branch/src/app/composer/qgscomposerview.h
===================================================================
--- branches/advanced_printing_branch/src/app/composer/qgscomposerview.h 2008-08-16 09:56:51 UTC (rev 9063)
+++ branches/advanced_printing_branch/src/app/composer/qgscomposerview.h 2008-08-16 11:39:43 UTC (rev 9064)
@@ -104,6 +104,9 @@
void composerPictureAdded(QgsComposerPicture* picture);
/**Is emitted when a composer item has been removed from the scene*/
void itemRemoved(QgsComposerItem*);
+ /**Current action (e.g. adding composer map) has been finished. The purpose of this signal is that
+ QgsComposer may set the selection tool again*/
+ void actionFinished();
};
#endif
More information about the QGIS-commit
mailing list