Skip to content

Commit 7353a4a

Browse files
author
mhugent
committed
Update composition item with signal in case the paper size has been changed
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@11817 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 653abd6 commit 7353a4a

File tree

5 files changed

+10
-2
lines changed

5 files changed

+10
-2
lines changed

src/app/composer/qgscomposer.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ QgsComposer::QgsComposer( QgisApp *qgis ): QMainWindow(), mFirstPaint( true )
181181
mView->setComposition( mComposition );
182182

183183
QgsCompositionWidget* compositionWidget = new QgsCompositionWidget( mCompositionOptionsFrame, mComposition );
184+
QObject::connect( mComposition, SIGNAL( paperSizeChanged() ), compositionWidget, SLOT( displayCompositionWidthHeight() ) );
184185
compositionWidget->show();
185186

186187
mCompositionOptionsLayout = new QGridLayout( mCompositionOptionsFrame );
@@ -1097,6 +1098,7 @@ void QgsComposer::readXML( const QDomDocument& doc )
10971098

10981099
//create compositionwidget
10991100
QgsCompositionWidget* compositionWidget = new QgsCompositionWidget( mCompositionOptionsFrame, mComposition );
1101+
QObject::connect( mComposition, SIGNAL( paperSizeChanged() ), compositionWidget, SLOT( displayCompositionWidthHeight() ) );
11001102
compositionWidget->show();
11011103

11021104
mCompositionOptionsLayout = new QGridLayout( mCompositionOptionsFrame );

src/app/composer/qgscompositionwidget.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ class QgsCompositionWidget: public QWidget, private Ui::QgsCompositionWidgetBase
5555
void on_mGridColorButton_clicked();
5656
void on_mGridStyleComboBox_currentIndexChanged( const QString& text );
5757
void on_mPenWidthSpinBox_valueChanged( double d );
58+
/**Sets GUI elements to width/height from composition*/
59+
void displayCompositionWidthHeight();
5860

5961
private:
6062
QgsComposition* mComposition;
@@ -67,8 +69,6 @@ class QgsCompositionWidget: public QWidget, private Ui::QgsCompositionWidgetBase
6769
void applyWidthHeight();
6870
/**Makes sure width/height values for custom paper matches the current orientation*/
6971
void adjustOrientation();
70-
/**Sets GUI elements to width/height from composition*/
71-
void displayCompositionWidthHeight();
7272
/**Sets GUI elements to snaping distances of composition*/
7373
void displaySnapingSettings();
7474

src/core/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ composer/qgscomposermap.h
181181
composer/qgscomposerpicture.h
182182
composer/qgscomposerscalebar.h
183183
composer/qgscomposeritemgroup.h
184+
composer/qgscomposition.h
184185
composer/qgslegendmodel.h
185186
symbology/qgsmarkercatalogue.h
186187
raster/qgsrasterlayer.h

src/core/composer/qgscomposition.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ void QgsComposition::setPaperSize( double width, double height )
5959
if ( mPaperItem )
6060
{
6161
mPaperItem->setRect( QRectF( 0, 0, width, height ) );
62+
emit paperSizeChanged();
6263
}
6364
}
6465

src/core/composer/qgscomposition.h

+4
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ class QDomElement;
3636
* */
3737
class CORE_EXPORT QgsComposition: public QGraphicsScene
3838
{
39+
Q_OBJECT
3940
public:
4041

4142
/** \brief Plot type */
@@ -187,6 +188,9 @@ class CORE_EXPORT QgsComposition: public QGraphicsScene
187188

188189
void loadGridAppearanceSettings();
189190
void saveGridAppearanceSettings();
191+
192+
signals:
193+
void paperSizeChanged();
190194
};
191195

192196
#endif

0 commit comments

Comments
 (0)