starting to refresh the scalebar composer item

This commit is contained in:
redlegoreng 2013-01-19 18:36:27 +00:00 committed by Marco Hugentobler
parent 6dcb5f4f4d
commit bce952c69d
3 changed files with 159 additions and 93 deletions

View File

@ -204,7 +204,7 @@ void QgsComposerScaleBarWidget::on_mLineWidthSpinBox_valueChanged( double d )
mComposerScaleBar->beginCommand( tr( "Scalebar line width" ), QgsComposerMergeCommand::ScaleBarLineWidth ); mComposerScaleBar->beginCommand( tr( "Scalebar line width" ), QgsComposerMergeCommand::ScaleBarLineWidth );
disconnectUpdateSignal(); disconnectUpdateSignal();
QPen newPen( QColor( 0, 0, 0 ) ); QPen newPen( mComposerScaleBar->pen().color() );
newPen.setWidthF( d ); newPen.setWidthF( d );
mComposerScaleBar->setPen( newPen ); mComposerScaleBar->setPen( newPen );
mComposerScaleBar->update(); mComposerScaleBar->update();
@ -321,6 +321,30 @@ void QgsComposerScaleBarWidget::on_mColorPushButton_clicked()
mComposerScaleBar->endCommand(); mComposerScaleBar->endCommand();
} }
void QgsComposerScaleBarWidget::on_mStrokeColorPushButton_clicked()
{
if ( !mComposerScaleBar )
{
return;
}
QColor oldColor = mComposerScaleBar->pen().color();
QColor newColor = QColorDialog::getColor( oldColor, 0 );
if ( !newColor.isValid() ) //user canceled the dialog
{
return;
}
mComposerScaleBar->beginCommand( tr( "Scalebar color changed" ) );
disconnectUpdateSignal();
QPen newPen( newColor );
mComposerScaleBar->setPen( newBrush );
mComposerScaleBar->update();
connectUpdateSignal();
mComposerScaleBar->endCommand();
}
void QgsComposerScaleBarWidget::on_mUnitLabelLineEdit_textChanged( const QString& text ) void QgsComposerScaleBarWidget::on_mUnitLabelLineEdit_textChanged( const QString& text )
{ {
if ( !mComposerScaleBar ) if ( !mComposerScaleBar )

View File

@ -42,6 +42,7 @@ class QgsComposerScaleBarWidget: public QWidget, private Ui::QgsComposerScaleBar
void on_mUnitLabelLineEdit_textChanged( const QString& text ); void on_mUnitLabelLineEdit_textChanged( const QString& text );
void on_mMapUnitsPerBarUnitSpinBox_valueChanged( double d ); void on_mMapUnitsPerBarUnitSpinBox_valueChanged( double d );
void on_mColorPushButton_clicked(); void on_mColorPushButton_clicked();
void on_mStrokeColorPushButton_clicked();
void on_mFontButton_clicked(); void on_mFontButton_clicked();
void on_mStyleComboBox_currentIndexChanged( const QString& text ); void on_mStyleComboBox_currentIndexChanged( const QString& text );
void on_mLabelBarSpaceSpinBox_valueChanged( double d ); void on_mLabelBarSpaceSpinBox_valueChanged( double d );

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>325</width> <width>436</width>
<height>537</height> <height>499</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -19,22 +19,25 @@
<property name="windowTitle"> <property name="windowTitle">
<string>Barscale Options</string> <string>Barscale Options</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<property name="margin"> <property name="margin">
<number>0</number> <number>0</number>
</property> </property>
<item row="0" column="0"> <item>
<widget class="QToolBox" name="toolBox"> <widget class="QToolBox" name="toolBox">
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="page"> <widget class="QWidget" name="page">
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>-138</y>
<width>315</width> <width>415</width>
<height>501</height> <height>636</height>
</rect> </rect>
</property> </property>
<attribute name="label"> <attribute name="label">
@ -42,31 +45,8 @@
</attribute> </attribute>
<layout class="QFormLayout" name="formLayout"> <layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy"> <property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum> <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property> </property>
<item row="0" column="0">
<widget class="QLabel" name="mSegmentSizeLabel">
<property name="text">
<string>Segment size</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="buddy">
<cstring>mSegmentSizeSpinBox</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="mSegmentSizeSpinBox">
<property name="decimals">
<number>4</number>
</property>
<property name="maximum">
<double>9999999999999.000000000000000</double>
</property>
</widget>
</item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="mUnitsLabel"> <widget class="QLabel" name="mUnitsLabel">
<property name="text"> <property name="text">
@ -74,7 +54,26 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0"> <item row="1" column="1">
<widget class="QComboBox" name="mUnitsComboBox"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="mUnitLabelLabel">
<property name="text">
<string>Unit label</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="buddy">
<cstring>mUnitLabelLineEdit</cstring>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="mUnitLabelLineEdit"/>
</item>
<item row="4" column="0">
<widget class="QLabel" name="mMapUnitsPerBarUnitLabel"> <widget class="QLabel" name="mMapUnitsPerBarUnitLabel">
<property name="text"> <property name="text">
<string>Map units per bar unit</string> <string>Map units per bar unit</string>
@ -87,32 +86,62 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1"> <item row="4" column="1">
<widget class="QDoubleSpinBox" name="mMapUnitsPerBarUnitSpinBox"> <widget class="QDoubleSpinBox" name="mMapUnitsPerBarUnitSpinBox">
<property name="maximum"> <property name="maximum">
<double>9999999999999.000000000000000</double> <double>9999999999999.000000000000000</double>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0" colspan="2"> <item row="5" column="0">
<widget class="QLabel" name="mSegmentSizeLabel">
<property name="text">
<string>Segment size</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="buddy">
<cstring>mSegmentSizeSpinBox</cstring>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QDoubleSpinBox" name="mSegmentSizeSpinBox">
<property name="decimals">
<number>4</number>
</property>
<property name="maximum">
<double>9999999999999.000000000000000</double>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="mSegmentLabel">
<property name="text">
<string>Segments</string>
</property>
</widget>
</item>
<item row="6" column="1">
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
<widget class="QSpinBox" name="mSegmentsLeftSpinBox"> <widget class="QSpinBox" name="mSegmentsLeftSpinBox">
<property name="suffix"> <property name="suffix">
<string> Left segments</string> <string> left</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QSpinBox" name="mNumberOfSegmentsSpinBox"> <widget class="QSpinBox" name="mNumberOfSegmentsSpinBox">
<property name="suffix"> <property name="suffix">
<string> Right segments</string> <string> right</string>
</property> </property>
</widget> </widget>
</item> </item>
</layout> </layout>
</item> </item>
<item row="4" column="0"> <item row="8" column="0">
<widget class="QLabel" name="mStyleLabel"> <widget class="QLabel" name="mStyleLabel">
<property name="text"> <property name="text">
<string>Style</string> <string>Style</string>
@ -122,10 +151,10 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="1"> <item row="8" column="1">
<widget class="QComboBox" name="mStyleComboBox"/> <widget class="QComboBox" name="mStyleComboBox"/>
</item> </item>
<item row="5" column="0"> <item row="9" column="0">
<widget class="QLabel" name="mMapLabel"> <widget class="QLabel" name="mMapLabel">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed"> <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
@ -144,7 +173,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="1"> <item row="9" column="1">
<widget class="QComboBox" name="mMapComboBox"> <widget class="QComboBox" name="mMapComboBox">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>true</bool>
@ -157,17 +186,17 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="0"> <item row="10" column="0">
<widget class="QLabel" name="mAlignmentLabel"> <widget class="QLabel" name="mAlignmentLabel">
<property name="text"> <property name="text">
<string>Alignment</string> <string>Alignment</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="1"> <item row="10" column="1">
<widget class="QComboBox" name="mAlignmentComboBox"/> <widget class="QComboBox" name="mAlignmentComboBox"/>
</item> </item>
<item row="7" column="0" colspan="2"> <item row="14" column="0" colspan="2">
<widget class="QSpinBox" name="mHeightSpinBox"> <widget class="QSpinBox" name="mHeightSpinBox">
<property name="suffix"> <property name="suffix">
<string> mm</string> <string> mm</string>
@ -177,7 +206,17 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="8" column="0" colspan="2"> <item row="15" column="0" colspan="2">
<widget class="QDoubleSpinBox" name="mLabelBarSpaceSpinBox">
<property name="prefix">
<string>Label space </string>
</property>
<property name="suffix">
<string> mm</string>
</property>
</widget>
</item>
<item row="16" column="0" colspan="2">
<widget class="QDoubleSpinBox" name="mLineWidthSpinBox"> <widget class="QDoubleSpinBox" name="mLineWidthSpinBox">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed"> <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
@ -202,17 +241,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="9" column="0" colspan="2"> <item row="17" column="0" colspan="2">
<widget class="QDoubleSpinBox" name="mLabelBarSpaceSpinBox">
<property name="prefix">
<string>Label space </string>
</property>
<property name="suffix">
<string> mm</string>
</property>
</widget>
</item>
<item row="10" column="0" colspan="2">
<widget class="QDoubleSpinBox" name="mBoxSizeSpinBox"> <widget class="QDoubleSpinBox" name="mBoxSizeSpinBox">
<property name="prefix"> <property name="prefix">
<string>Box space </string> <string>Box space </string>
@ -222,43 +251,37 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="11" column="0"> <item row="19" column="0" colspan="2">
<widget class="QLabel" name="mUnitLabelLabel"> <layout class="QHBoxLayout" name="horizontalLayout2">
<property name="text"> <property name="margin">
<string>Unit label</string> <number>0</number>
</property> </property>
<property name="wordWrap"> <item>
<bool>true</bool> <widget class="QPushButton" name="mFontButton">
</property> <property name="sizePolicy">
<property name="buddy"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<cstring>mUnitLabelLineEdit</cstring> <horstretch>0</horstretch>
</property> <verstretch>0</verstretch>
</widget> </sizepolicy>
</property>
<property name="text">
<string>Font...</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="mFontColorButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Font color...</string>
</property>
</widget>
</item>
</layout>
</item> </item>
<item row="11" column="1"> <item row="22" column="0" colspan="2">
<widget class="QLineEdit" name="mUnitLabelLineEdit"/>
</item>
<item row="12" column="0" colspan="2">
<widget class="QPushButton" name="mFontButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Font...</string>
</property>
</widget>
</item>
<item row="13" column="0" colspan="2">
<widget class="QPushButton" name="mColorPushButton">
<property name="text">
<string>Color...</string>
</property>
</widget>
</item>
<item row="14" column="0" colspan="2">
<spacer name="verticalSpacer"> <spacer name="verticalSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
@ -271,8 +294,26 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="1" column="1"> <item row="20" column="0" colspan="2">
<widget class="QComboBox" name="mUnitsComboBox"/> <layout class="QHBoxLayout" name="horizontalLayout3">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="mColorPushButton">
<property name="text">
<string>Fill color...</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="mStrokeColorPushButton">
<property name="text">
<string>Stroke color...</string>
</property>
</widget>
</item>
</layout>
</item> </item>
</layout> </layout>
</widget> </widget>