[QGIS Commit] r12086 - trunk/qgis/src/app/composer
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Wed Nov 11 05:38:41 EST 2009
Author: mhugent
Date: 2009-11-11 05:38:40 -0500 (Wed, 11 Nov 2009)
New Revision: 12086
Modified:
trunk/qgis/src/app/composer/qgscompositionwidget.cpp
trunk/qgis/src/app/composer/qgscompositionwidget.h
Log:
Fix for restoring paper settings in compositionwidget
Modified: trunk/qgis/src/app/composer/qgscompositionwidget.cpp
===================================================================
--- trunk/qgis/src/app/composer/qgscompositionwidget.cpp 2009-11-11 09:58:30 UTC (rev 12085)
+++ trunk/qgis/src/app/composer/qgscompositionwidget.cpp 2009-11-11 10:38:40 UTC (rev 12086)
@@ -24,6 +24,7 @@
QgsCompositionWidget::QgsCompositionWidget( QWidget* parent, QgsComposition* c ): QWidget( parent ), mComposition( c )
{
setupUi( this );
+ blockSignals( true );
createPaperEntries();
//unit
@@ -31,10 +32,8 @@
mPaperUnitsComboBox->addItem( tr( "inch" ) );
//orientation
- mPaperOrientationComboBox->blockSignals( true );
mPaperOrientationComboBox->insertItem( 0, tr( "Landscape" ) );
mPaperOrientationComboBox->insertItem( 1, tr( "Portrait" ) );
- mPaperOrientationComboBox->blockSignals( false );
mPaperOrientationComboBox->setCurrentIndex( 0 );
//read with/height from composition and find suitable entries to display
@@ -70,16 +69,11 @@
//grid pen width
- mPenWidthSpinBox->blockSignals( true );
mPenWidthSpinBox->setValue( mComposition->gridPen().widthF() );
- mPenWidthSpinBox->blockSignals( false );
//grid pen color
- mGridColorButton->blockSignals( true );
mGridColorButton->setColor( mComposition->gridPen().color() );
- mGridColorButton->blockSignals( false );
- mGridStyleComboBox->blockSignals( true );
mGridStyleComboBox->insertItem( 0, tr( "Solid" ) );
mGridStyleComboBox->insertItem( 1, tr( "Dots" ) );
mGridStyleComboBox->insertItem( 2, tr( "Crosses" ) );
@@ -97,8 +91,8 @@
{
mGridStyleComboBox->setCurrentIndex( 2 );
}
- mGridStyleComboBox->blockSignals( false );
}
+ blockSignals( false );
}
QgsCompositionWidget::QgsCompositionWidget(): QWidget( 0 ), mComposition( 0 )
@@ -143,8 +137,6 @@
<< QgsCompositionPaper( tr( "Arch E (36x48 inches)" ), 914.4, 1219.2 )
<< QgsCompositionPaper( tr( "Arch E1 (30x42 inches)" ), 762, 1066.8 )
;
-
- mPaperSizeComboBox->blockSignals( true );
mPaperSizeComboBox->addItem( tr( "Custom" ) );
for ( QList<QgsCompositionPaper>::const_iterator it = formats.begin(); it != formats.end(); it++ )
@@ -152,8 +144,6 @@
mPaperSizeComboBox->addItem( it->mName );
mPaperMap.insert( it->mName, *it );
}
-
- mPaperSizeComboBox->blockSignals( false );
mPaperSizeComboBox->setCurrentIndex( 2 ); //A4
}
@@ -266,7 +256,7 @@
else
{
// inch (show width in inch)
- spin->setValue( v / 25.4 );
+ spin->setValue( v / 25.4 );
}
}
@@ -337,14 +327,6 @@
return;
}
- //block all signals to avoid infinite recursion
- mPaperSizeComboBox->blockSignals( true );
- mPaperUnitsComboBox->blockSignals( true );
- mPaperWidthDoubleSpinBox->blockSignals( true );
- mPaperHeightDoubleSpinBox->blockSignals( true );
- mPaperOrientationComboBox->blockSignals( true );
- mResolutionSpinBox->blockSignals( true );
-
double paperWidth = mComposition->paperWidth();
setSize( mPaperWidthDoubleSpinBox, paperWidth );
@@ -383,13 +365,6 @@
//custom
mPaperSizeComboBox->setCurrentIndex( 0 );
}
-
- mPaperSizeComboBox->blockSignals( false );
- mPaperUnitsComboBox->blockSignals( false );
- mPaperWidthDoubleSpinBox->blockSignals( false );
- mPaperHeightDoubleSpinBox->blockSignals( false );
- mPaperOrientationComboBox->blockSignals( false );
- mResolutionSpinBox->blockSignals( false );
}
void QgsCompositionWidget::displaySnapingSettings()
@@ -399,11 +374,6 @@
return;
}
- mSnapToGridCheckBox->blockSignals( true );
- mGridResolutionSpinBox->blockSignals( true );
- mOffsetXSpinBox->blockSignals( true );
- mOffsetYSpinBox->blockSignals( true );
-
if ( mComposition->snapToGridEnabled() )
{
mSnapToGridCheckBox->setCheckState( Qt::Checked );
@@ -416,11 +386,6 @@
mGridResolutionSpinBox->setValue( mComposition->snapGridResolution() );
mOffsetXSpinBox->setValue( mComposition->snapGridOffsetX() );
mOffsetYSpinBox->setValue( mComposition->snapGridOffsetY() );
-
- mSnapToGridCheckBox->blockSignals( false );
- mGridResolutionSpinBox->blockSignals( false );
- mOffsetXSpinBox->blockSignals( false );
- mOffsetYSpinBox->blockSignals( false );
}
void QgsCompositionWidget::on_mResolutionSpinBox_valueChanged( const int value )
@@ -529,3 +494,21 @@
mComposition->setGridPen( pen );
}
}
+
+void QgsCompositionWidget::blockSignals( bool block )
+{
+ mPaperSizeComboBox->blockSignals( block );
+ mPaperUnitsComboBox->blockSignals( block );
+ mPaperWidthDoubleSpinBox->blockSignals( block );
+ mPaperHeightDoubleSpinBox->blockSignals( block );
+ mPaperOrientationComboBox->blockSignals( block );
+ mResolutionSpinBox->blockSignals( block );
+ mPrintAsRasterCheckBox->blockSignals( block );
+ mSnapToGridCheckBox->blockSignals( block );
+ mGridResolutionSpinBox->blockSignals( block );
+ mOffsetXSpinBox->blockSignals( block );
+ mOffsetYSpinBox->blockSignals( block );
+ mPenWidthSpinBox->blockSignals( block );
+ mGridColorButton->blockSignals( block );
+ mGridStyleComboBox->blockSignals( block );
+}
Modified: trunk/qgis/src/app/composer/qgscompositionwidget.h
===================================================================
--- trunk/qgis/src/app/composer/qgscompositionwidget.h 2009-11-11 09:58:30 UTC (rev 12085)
+++ trunk/qgis/src/app/composer/qgscompositionwidget.h 2009-11-11 10:38:40 UTC (rev 12086)
@@ -77,4 +77,6 @@
double size( QDoubleSpinBox *spin );
void setSize( QDoubleSpinBox *spin, double v );
+ /**Blocks / unblocks the signals of all items*/
+ void blockSignals( bool block );
};
More information about the QGIS-commit
mailing list