[QGIS Commit] r12070 - in trunk/qgis/src: app/composer ui
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Tue Nov 10 09:48:09 EST 2009
Author: timlinux
Date: 2009-11-10 09:48:09 -0500 (Tue, 10 Nov 2009)
New Revision: 12070
Modified:
trunk/qgis/src/app/composer/qgscompositionwidget.cpp
trunk/qgis/src/app/composer/qgscompositionwidget.h
trunk/qgis/src/ui/qgscompositionwidgetbase.ui
Log:
UI updates for compositionwidget
Modified: trunk/qgis/src/app/composer/qgscompositionwidget.cpp
===================================================================
--- trunk/qgis/src/app/composer/qgscompositionwidget.cpp 2009-11-10 14:42:42 UTC (rev 12069)
+++ trunk/qgis/src/app/composer/qgscompositionwidget.cpp 2009-11-10 14:48:09 UTC (rev 12070)
@@ -43,7 +43,7 @@
if ( mComposition )
{
//read printout resolution from composition
- mResolutionLineEdit->setText( QString::number( mComposition->printResolution() ) );
+ mResolutionSpinBox->setValue( mComposition->printResolution() );
//print as raster
if ( mComposition->printAsRaster() )
@@ -64,7 +64,7 @@
{
mSnapToGridCheckBox->setCheckState( Qt::Unchecked );
}
- mResolutionSpinBox->setValue( mComposition->snapGridResolution() );
+ mGridResolutionSpinBox->setValue( mComposition->snapGridResolution() );
mOffsetXSpinBox->setValue( mComposition->snapGridOffsetX() );
mOffsetYSpinBox->setValue( mComposition->snapGridOffsetY() );
@@ -154,20 +154,21 @@
}
mPaperSizeComboBox->blockSignals( false );
+ mPaperSizeComboBox->setCurrentIndex( 2 ); //A4
}
void QgsCompositionWidget::on_mPaperSizeComboBox_currentIndexChanged( const QString& text )
{
if ( mPaperSizeComboBox->currentText() == tr( "Custom" ) )
{
- mPaperWidthLineEdit->setEnabled( true );
- mPaperHeightLineEdit->setEnabled( true );
+ mPaperWidthDoubleSpinBox->setEnabled( true );
+ mPaperHeightDoubleSpinBox->setEnabled( true );
mPaperUnitsComboBox->setEnabled( true );
}
else
{
- mPaperWidthLineEdit->setEnabled( false );
- mPaperHeightLineEdit->setEnabled( false );
+ mPaperWidthDoubleSpinBox->setEnabled( false );
+ mPaperHeightDoubleSpinBox->setEnabled( false );
mPaperUnitsComboBox->setEnabled( false );
}
applyCurrentPaperSettings();
@@ -189,8 +190,8 @@
void QgsCompositionWidget::on_mPaperUnitsComboBox_currentIndexChanged( const QString& text )
{
- double width = size( mPaperWidthLineEdit );
- double height = size( mPaperHeightLineEdit );
+ double width = size( mPaperWidthDoubleSpinBox );
+ double height = size( mPaperHeightDoubleSpinBox );
if ( mPaperUnitsComboBox->currentIndex() == 0 )
{
@@ -205,8 +206,8 @@
height /= 25.4;
}
- setSize( mPaperWidthLineEdit, width );
- setSize( mPaperHeightLineEdit, height );
+ setSize( mPaperWidthDoubleSpinBox, width );
+ setSize( mPaperHeightDoubleSpinBox, height );
if ( mPaperSizeComboBox->currentText() == tr( "Custom" ) )
{
@@ -222,8 +223,8 @@
void QgsCompositionWidget::adjustOrientation()
{
- double width = size( mPaperWidthLineEdit );
- double height = size( mPaperHeightLineEdit );
+ double width = size( mPaperWidthDoubleSpinBox );
+ double height = size( mPaperHeightDoubleSpinBox );
if ( width < 0 || height < 0 )
{
@@ -237,46 +238,42 @@
height = tmp;
}
- bool lineEditsEnabled = mPaperWidthLineEdit->isEnabled();
+ bool lineEditsEnabled = mPaperWidthDoubleSpinBox->isEnabled();
- mPaperWidthLineEdit->setEnabled( true );
- mPaperHeightLineEdit->setEnabled( true );
+ mPaperWidthDoubleSpinBox->setEnabled( true );
+ mPaperHeightDoubleSpinBox->setEnabled( true );
if ( mPaperOrientationComboBox->currentText() == tr( "Landscape" ) )
{
- setSize( mPaperWidthLineEdit, width );
- setSize( mPaperHeightLineEdit, height );
+ setSize( mPaperWidthDoubleSpinBox, width );
+ setSize( mPaperHeightDoubleSpinBox, height );
}
else
{
- setSize( mPaperWidthLineEdit, height );
- setSize( mPaperHeightLineEdit, width );
+ setSize( mPaperWidthDoubleSpinBox, height );
+ setSize( mPaperHeightDoubleSpinBox, width );
}
- mPaperWidthLineEdit->setEnabled( lineEditsEnabled );
- mPaperHeightLineEdit->setEnabled( lineEditsEnabled );
+ mPaperWidthDoubleSpinBox->setEnabled( lineEditsEnabled );
+ mPaperHeightDoubleSpinBox->setEnabled( lineEditsEnabled );
}
-void QgsCompositionWidget::setSize( QLineEdit *le, double v )
+void QgsCompositionWidget::setSize( QDoubleSpinBox *spin, double v )
{
if ( mPaperUnitsComboBox->currentIndex() == 0 )
{
// mm
- le->setText( QString( "%1" ).arg( v ) );
+ spin->setValue( v );
}
else
{
// inch (show width in inch)
- le->setText( QString( "%1" ).arg( v / 25.4 ) );
+ spin->setValue( v / 25.4 );
}
}
-double QgsCompositionWidget::size( QLineEdit *le )
+double QgsCompositionWidget::size( QDoubleSpinBox *spin )
{
- bool conversionSuccess;
+ double size = spin->value();
- double size = le->text().toDouble( &conversionSuccess );
- if ( !conversionSuccess )
- return -1.0;
-
if ( mPaperUnitsComboBox->currentIndex() == 0 )
{
// mm
@@ -300,12 +297,12 @@
return;
}
- mPaperWidthLineEdit->setEnabled( true );
- mPaperHeightLineEdit->setEnabled( true );
- setSize( mPaperWidthLineEdit, it->mWidth );
- setSize( mPaperHeightLineEdit, it->mHeight );
- mPaperWidthLineEdit->setEnabled( false );
- mPaperHeightLineEdit->setEnabled( false );
+ mPaperWidthDoubleSpinBox->setEnabled( true );
+ mPaperHeightDoubleSpinBox->setEnabled( true );
+ setSize( mPaperWidthDoubleSpinBox, it->mWidth );
+ setSize( mPaperHeightDoubleSpinBox, it->mHeight );
+ mPaperWidthDoubleSpinBox->setEnabled( false );
+ mPaperHeightDoubleSpinBox->setEnabled( false );
adjustOrientation();
applyWidthHeight();
@@ -314,8 +311,8 @@
void QgsCompositionWidget::applyWidthHeight()
{
- double width = size( mPaperWidthLineEdit );
- double height = size( mPaperHeightLineEdit );
+ double width = size( mPaperWidthDoubleSpinBox );
+ double height = size( mPaperHeightDoubleSpinBox );
if ( width < 0 || height < 0 )
return;
@@ -323,12 +320,12 @@
mComposition->setPaperSize( width, height );
}
-void QgsCompositionWidget::on_mPaperWidthLineEdit_editingFinished()
+void QgsCompositionWidget::on_mPaperWidthDoubleSpinBox_editingFinished()
{
applyWidthHeight();
}
-void QgsCompositionWidget::on_mPaperHeightLineEdit_editingFinished()
+void QgsCompositionWidget::on_mPaperHeightDoubleSpinBox_editingFinished()
{
applyWidthHeight();
}
@@ -343,16 +340,16 @@
//block all signals to avoid infinite recursion
mPaperSizeComboBox->blockSignals( true );
mPaperUnitsComboBox->blockSignals( true );
- mPaperWidthLineEdit->blockSignals( true );
- mPaperHeightLineEdit->blockSignals( true );
+ mPaperWidthDoubleSpinBox->blockSignals( true );
+ mPaperHeightDoubleSpinBox->blockSignals( true );
mPaperOrientationComboBox->blockSignals( true );
- mResolutionLineEdit->blockSignals( true );
+ mResolutionSpinBox->blockSignals( true );
double paperWidth = mComposition->paperWidth();
- setSize( mPaperWidthLineEdit, paperWidth );
+ setSize( mPaperWidthDoubleSpinBox, paperWidth );
double paperHeight = mComposition->paperHeight();
- setSize( mPaperHeightLineEdit, paperHeight );
+ setSize( mPaperHeightDoubleSpinBox, paperHeight );
//set orientation
if ( paperWidth > paperHeight )
@@ -389,10 +386,10 @@
mPaperSizeComboBox->blockSignals( false );
mPaperUnitsComboBox->blockSignals( false );
- mPaperWidthLineEdit->blockSignals( false );
- mPaperHeightLineEdit->blockSignals( false );
+ mPaperWidthDoubleSpinBox->blockSignals( false );
+ mPaperHeightDoubleSpinBox->blockSignals( false );
mPaperOrientationComboBox->blockSignals( false );
- mResolutionLineEdit->blockSignals( false );
+ mResolutionSpinBox->blockSignals( false );
}
void QgsCompositionWidget::displaySnapingSettings()
@@ -403,7 +400,7 @@
}
mSnapToGridCheckBox->blockSignals( true );
- mResolutionSpinBox->blockSignals( true );
+ mGridResolutionSpinBox->blockSignals( true );
mOffsetXSpinBox->blockSignals( true );
mOffsetYSpinBox->blockSignals( true );
@@ -416,30 +413,19 @@
mSnapToGridCheckBox->setCheckState( Qt::Unchecked );
}
- mResolutionSpinBox->setValue( mComposition->snapGridResolution() );
+ mGridResolutionSpinBox->setValue( mComposition->snapGridResolution() );
mOffsetXSpinBox->setValue( mComposition->snapGridOffsetX() );
mOffsetYSpinBox->setValue( mComposition->snapGridOffsetY() );
mSnapToGridCheckBox->blockSignals( false );
- mResolutionSpinBox->blockSignals( false );
+ mGridResolutionSpinBox->blockSignals( false );
mOffsetXSpinBox->blockSignals( false );
mOffsetYSpinBox->blockSignals( false );
}
-void QgsCompositionWidget::on_mResolutionLineEdit_textChanged( const QString& text )
+void QgsCompositionWidget::on_mResolutionSpinBox_valueChanged( const int value )
{
- bool conversionOk;
- int resolution = text.toInt( &conversionOk );
- if ( conversionOk && mComposition )
- {
- mComposition->setPrintResolution( resolution );
- }
- else if ( mComposition )
- {
- //set screen resolution per default
- QPrinter resolutionInfo( QPrinter::ScreenResolution );
- mComposition->setPrintResolution( resolutionInfo.resolution() );
- }
+ mComposition->setPrintResolution( value );
}
void QgsCompositionWidget::on_mPrintAsRasterCheckBox_stateChanged( int state )
@@ -474,7 +460,7 @@
}
}
-void QgsCompositionWidget::on_mResolutionSpinBox_valueChanged( double d )
+void QgsCompositionWidget::on_mGridResolutionSpinBox_valueChanged( double d )
{
if ( mComposition )
{
Modified: trunk/qgis/src/app/composer/qgscompositionwidget.h
===================================================================
--- trunk/qgis/src/app/composer/qgscompositionwidget.h 2009-11-10 14:42:42 UTC (rev 12069)
+++ trunk/qgis/src/app/composer/qgscompositionwidget.h 2009-11-10 14:48:09 UTC (rev 12070)
@@ -43,13 +43,13 @@
void on_mPaperSizeComboBox_currentIndexChanged( const QString& text );
void on_mPaperUnitsComboBox_currentIndexChanged( const QString& text );
void on_mPaperOrientationComboBox_currentIndexChanged( const QString& text );
- void on_mPaperWidthLineEdit_editingFinished();
- void on_mPaperHeightLineEdit_editingFinished();
- void on_mResolutionLineEdit_textChanged( const QString& text );
+ void on_mPaperWidthDoubleSpinBox_editingFinished();
+ void on_mPaperHeightDoubleSpinBox_editingFinished();
+ void on_mResolutionSpinBox_valueChanged( const int value );
void on_mPrintAsRasterCheckBox_stateChanged( int state );
void on_mSnapToGridCheckBox_stateChanged( int state );
- void on_mResolutionSpinBox_valueChanged( double d );
+ void on_mGridResolutionSpinBox_valueChanged( double d );
void on_mOffsetXSpinBox_valueChanged( double d );
void on_mOffsetYSpinBox_valueChanged( double d );
void on_mGridColorButton_clicked();
@@ -75,6 +75,6 @@
void createPaperEntries();
void insertPaperEntries();
- double size( QLineEdit *le );
- void setSize( QLineEdit *le, double v );
+ double size( QDoubleSpinBox *spin );
+ void setSize( QDoubleSpinBox *spin, double v );
};
Modified: trunk/qgis/src/ui/qgscompositionwidgetbase.ui
===================================================================
--- trunk/qgis/src/ui/qgscompositionwidgetbase.ui 2009-11-10 14:42:42 UTC (rev 12069)
+++ trunk/qgis/src/ui/qgscompositionwidgetbase.ui 2009-11-10 14:48:09 UTC (rev 12070)
@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>416</width>
- <height>620</height>
+ <height>570</height>
</rect>
</property>
<property name="sizePolicy">
@@ -32,9 +32,9 @@
<property name="geometry">
<rect>
<x>0</x>
- <y>-72</y>
- <width>396</width>
- <height>688</height>
+ <y>0</y>
+ <width>393</width>
+ <height>707</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_3">
@@ -98,7 +98,7 @@
<item row="3" column="0">
<widget class="QComboBox" name="mPaperUnitsComboBox">
<property name="enabled">
- <bool>false</bool>
+ <bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
@@ -108,51 +108,7 @@
</property>
</widget>
</item>
- <item row="4" column="0">
- <widget class="QLabel" name="textLabel4">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Width</string>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- <property name="buddy">
- <cstring>mPaperWidthLineEdit</cstring>
- </property>
- </widget>
- </item>
- <item row="5" column="0">
- <widget class="QLineEdit" name="mPaperWidthLineEdit"/>
- </item>
<item row="6" column="0">
- <widget class="QLabel" name="textLabel6">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Height</string>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- <property name="buddy">
- <cstring>mPaperHeightLineEdit</cstring>
- </property>
- </widget>
- </item>
- <item row="7" column="0">
- <widget class="QLineEdit" name="mPaperHeightLineEdit"/>
- </item>
- <item row="8" column="0">
<widget class="QLabel" name="textLabel7">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@@ -171,7 +127,7 @@
</property>
</widget>
</item>
- <item row="9" column="0">
+ <item row="7" column="0">
<widget class="QComboBox" name="mPaperOrientationComboBox">
<property name="enabled">
<bool>true</bool>
@@ -184,33 +140,50 @@
</property>
</widget>
</item>
- <item row="10" column="0">
- <widget class="QLabel" name="mResolutionLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
+ <item row="9" column="0">
+ <widget class="QCheckBox" name="mPrintAsRasterCheckBox">
<property name="text">
- <string>Print quality (dpi)</string>
+ <string>Print as raster</string>
</property>
- <property name="wordWrap">
- <bool>true</bool>
+ </widget>
+ </item>
+ <item row="8" column="0">
+ <widget class="QSpinBox" name="mResolutionSpinBox">
+ <property name="suffix">
+ <string> dpi</string>
</property>
- <property name="buddy">
- <cstring>mResolutionLineEdit</cstring>
+ <property name="prefix">
+ <string>Quality </string>
</property>
+ <property name="maximum">
+ <number>3000</number>
+ </property>
</widget>
</item>
- <item row="11" column="0">
- <widget class="QLineEdit" name="mResolutionLineEdit"/>
+ <item row="4" column="0">
+ <widget class="QDoubleSpinBox" name="mPaperWidthDoubleSpinBox">
+ <property name="prefix">
+ <string>Width </string>
+ </property>
+ <property name="suffix">
+ <string/>
+ </property>
+ <property name="maximum">
+ <double>99999.000000000000000</double>
+ </property>
+ </widget>
</item>
- <item row="12" column="0">
- <widget class="QCheckBox" name="mPrintAsRasterCheckBox">
- <property name="text">
- <string>Print as raster</string>
+ <item row="5" column="0">
+ <widget class="QDoubleSpinBox" name="mPaperHeightDoubleSpinBox">
+ <property name="prefix">
+ <string>Height </string>
</property>
+ <property name="suffix">
+ <string/>
+ </property>
+ <property name="maximum">
+ <double>99999.000000000000000</double>
+ </property>
</widget>
</item>
</layout>
@@ -230,82 +203,43 @@
</widget>
</item>
<item row="1" column="0">
- <widget class="QLabel" name="mResolutionLabel_2">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
+ <widget class="QDoubleSpinBox" name="mGridResolutionSpinBox">
+ <property name="prefix">
+ <string>Spacing </string>
</property>
- <property name="text">
- <string>Grid resolution</string>
+ <property name="suffix">
+ <string/>
</property>
- <property name="wordWrap">
- <bool>true</bool>
+ <property name="maximum">
+ <double>9999.000000000000000</double>
</property>
- <property name="buddy">
- <cstring>mResolutionSpinBox</cstring>
- </property>
</widget>
</item>
<item row="2" column="0">
- <widget class="QDoubleSpinBox" name="mResolutionSpinBox"/>
- </item>
- <item row="3" column="0">
- <widget class="QLabel" name="mXOffsetLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
+ <widget class="QDoubleSpinBox" name="mOffsetXSpinBox">
+ <property name="prefix">
+ <string>X offset </string>
</property>
- <property name="text">
- <string>Offset x</string>
+ <property name="maximum">
+ <double>9999.000000000000000</double>
</property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- <property name="buddy">
- <cstring>mOffsetXSpinBox</cstring>
- </property>
</widget>
</item>
- <item row="4" column="0">
- <widget class="QDoubleSpinBox" name="mOffsetXSpinBox"/>
- </item>
- <item row="5" column="0">
- <widget class="QLabel" name="mYOffsetLabel">
- <property name="text">
- <string>Offset y</string>
+ <item row="3" column="0">
+ <widget class="QDoubleSpinBox" name="mOffsetYSpinBox">
+ <property name="prefix">
+ <string>Y offset </string>
</property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- <property name="buddy">
- <cstring>mOffsetYSpinBox</cstring>
- </property>
</widget>
</item>
- <item row="6" column="0">
- <widget class="QDoubleSpinBox" name="mOffsetYSpinBox"/>
- </item>
- <item row="7" column="0">
- <widget class="QLabel" name="mPenWidthLabel">
- <property name="text">
- <string>Pen width</string>
+ <item row="4" column="0">
+ <widget class="QDoubleSpinBox" name="mPenWidthSpinBox">
+ <property name="prefix">
+ <string>Pen width </string>
</property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- <property name="buddy">
- <cstring>mPenWidthSpinBox</cstring>
- </property>
</widget>
</item>
- <item row="8" column="0">
- <widget class="QDoubleSpinBox" name="mPenWidthSpinBox"/>
- </item>
- <item row="9" column="0">
+ <item row="5" column="0">
<widget class="QLabel" name="mGridColorLabel">
<property name="text">
<string>Grid color</string>
@@ -318,7 +252,7 @@
</property>
</widget>
</item>
- <item row="10" column="0">
+ <item row="6" column="0">
<widget class="QgsColorButton" name="mGridColorButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@@ -331,7 +265,7 @@
</property>
</widget>
</item>
- <item row="11" column="0">
+ <item row="7" column="0">
<widget class="QLabel" name="mGridStyleLabel">
<property name="text">
<string>Grid style</string>
@@ -344,12 +278,25 @@
</property>
</widget>
</item>
- <item row="12" column="0">
+ <item row="8" column="0">
<widget class="QComboBox" name="mGridStyleComboBox"/>
</item>
</layout>
</widget>
</item>
+ <item row="2" column="0">
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
</layout>
</widget>
</widget>
@@ -368,13 +315,10 @@
<tabstop>scrollArea</tabstop>
<tabstop>mPaperSizeComboBox</tabstop>
<tabstop>mPaperUnitsComboBox</tabstop>
- <tabstop>mPaperWidthLineEdit</tabstop>
- <tabstop>mPaperHeightLineEdit</tabstop>
<tabstop>mPaperOrientationComboBox</tabstop>
- <tabstop>mResolutionLineEdit</tabstop>
<tabstop>mPrintAsRasterCheckBox</tabstop>
<tabstop>mSnapToGridCheckBox</tabstop>
- <tabstop>mResolutionSpinBox</tabstop>
+ <tabstop>mGridResolutionSpinBox</tabstop>
<tabstop>mOffsetXSpinBox</tabstop>
<tabstop>mOffsetYSpinBox</tabstop>
<tabstop>mPenWidthSpinBox</tabstop>
More information about the QGIS-commit
mailing list