Skip to content
Permalink
Browse files

Apply patch in ticket #458 (user configurable colour for the measure

tool). Thanks to Lars.


git-svn-id: http://svn.osgeo.org/qgis/trunk@6375 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
g_j_m
g_j_m committed Jan 2, 2007
1 parent 4e80bf5 commit 01658469b835a7f646d98a4e20541880ad245531
Showing with 156 additions and 80 deletions.
  1. +13 −0 src/gui/qgsmeasure.cpp
  2. +22 −0 src/gui/qgsoptions.cpp
  3. +5 −0 src/gui/qgsoptions.h
  4. +116 −80 src/ui/qgsoptionsbase.ui
@@ -81,6 +81,12 @@ void QgsMeasure::activate()
mCalc->setDefaultEllipsoid();
mCalc->setProjectAsSourceSRS();

QSettings settings;
int myRed = settings.value("/qgis/default_measure_color_red", 180).toInt();
int myGreen = settings.value("/qgis/default_measure_color_green", 180).toInt();
int myBlue = settings.value("/qgis/default_measure_color_blue", 180).toInt();
mRubberBand->setColor(QColor(myRed, myGreen, myBlue));

// If we suspect that they have data that is projected, yet the
// map SRS is set to a geographic one, warn them.
if (mCalc->geographic() &&
@@ -136,6 +142,13 @@ void QgsMeasure::restart(void )

mRubberBand->reset(mMeasureArea);

// re-read color settings
QSettings settings;
int myRed = settings.value("/qgis/default_measure_color_red", 180).toInt();
int myGreen = settings.value("/qgis/default_measure_color_green", 180).toInt();
int myBlue = settings.value("/qgis/default_measure_color_blue", 180).toInt();
mRubberBand->setColor(QColor(myRed, myGreen, myBlue));

mRightMouseClicked = false;
}

@@ -122,6 +122,12 @@ QgsOptions::QgsOptions(QWidget *parent, Qt::WFlags fl) :
myGreen = settings.value("/qgis/default_canvas_color_green",255).toInt();
myBlue = settings.value("/qgis/default_canvas_color_blue",255).toInt();
pbnCanvasColor->setColor( QColor(myRed,myGreen,myBlue) );

// set the default color for the measure tool
myRed = settings.value("/qgis/default_measure_color_red",180).toInt();
myGreen = settings.value("/qgis/default_measure_color_green",180).toInt();
myBlue = settings.value("/qgis/default_measure_color_blue",180).toInt();
pbnMeasureColour->setColor( QColor(myRed,myGreen,myBlue) );

capitaliseCheckBox->setChecked(settings.value("qgis/capitaliseLayerName", QVariant(false)).toBool());

@@ -151,6 +157,16 @@ void QgsOptions::on_pbnCanvasColor_clicked()
pbnCanvasColor->setColor(color);
}
}

void QgsOptions::on_pbnMeasureColour_clicked()
{
QColor color = QColorDialog::getColor(pbnMeasureColour->color(), this);
if (color.isValid())
{
pbnMeasureColour->setColor(color);
}
}

void QgsOptions::themeChanged(const QString &newThemeName)
{
// Slot to change the theme as user scrolls through the choices
@@ -214,6 +230,12 @@ void QgsOptions::saveOptions()
myGreen = settings.writeEntry("/qgis/default_canvas_color_green",myColor.green());
myBlue = settings.writeEntry("/qgis/default_canvas_color_blue",myColor.blue());

//set the default color for the measure tool
myColor = pbnMeasureColour->color();
myRed = settings.setValue("/qgis/default_measure_color_red",myColor.red());
myGreen = settings.setValue("/qgis/default_measure_color_green",myColor.green());
myBlue = settings.setValue("/qgis/default_measure_color_blue",myColor.blue());

settings.writeEntry("/qgis/wheel_action", cmbWheelAction->currentIndex());
settings.writeEntry("/qgis/zoom_factor", spinZoomFactor->value());

@@ -68,6 +68,11 @@ class QgsOptions :public QDialog, private Ui::QgsOptionsBase
*/
void on_pbnSelectionColour_clicked();

/*!
* Slot to select the default measure tool colour
*/
void on_pbnMeasureColour_clicked();

/*!
* Slot to select the default map selection colour
*/
@@ -31,7 +31,7 @@
<item row="0" column="0" >
<widget class="QTabWidget" name="tabWidget" >
<property name="currentIndex" >
<number>0</number>
<number>2</number>
</property>
<widget class="QWidget" name="tabAppearance" >
<attribute name="title" >
@@ -152,7 +152,7 @@
<string>Selection Color:</string>
</property>
<property name="buddy" >
<cstring>pbnSelectionColour</cstring>
<cstring>pbnMeasureColour</cstring>
</property>
</widget>
</item>
@@ -408,23 +408,10 @@
<property name="spacing" >
<number>6</number>
</property>
<item row="3" column="0" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0" >
<widget class="QGroupBox" name="groupBox_7" >
<item row="2" column="0" >
<widget class="QGroupBox" name="groupBox_10" >
<property name="title" >
<string>Search radius</string>
<string>Panning and zooming</string>
</property>
<layout class="QGridLayout" >
<property name="margin" >
@@ -433,43 +420,49 @@
<property name="spacing" >
<number>6</number>
</property>
<item row="1" column="0" colspan="2" >
<widget class="QLabel" name="textLabel2" >
<item row="0" column="1" >
<widget class="QComboBox" name="cmbWheelAction" >
<item>
<property name="text" >
<string>Zoom</string>
</property>
</item>
<item>
<property name="text" >
<string>Zoom and recenter</string>
</property>
</item>
<item>
<property name="text" >
<string>Nothing</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="label_3" >
<property name="text" >
<string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
p, li { white-space: pre-wrap; }
&lt;/style>&lt;/head>&lt;body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;">
&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;span style=" font-weight:600;">Note:&lt;/span> Specify the search radius as a percentage of the map width.&lt;/p>
&lt;p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;/p>&lt;/body>&lt;/html></string>
</property>
<property name="wordWrap" >
<bool>true</bool>
<string>Zoom factor:</string>
</property>
</widget>
</item>
<item row="0" column="0" >
<widget class="QLabel" name="textLabel1_3" >
<widget class="QLabel" name="label_2" >
<property name="text" >
<string>Search Radius for Identifying Features</string>
</property>
<property name="buddy" >
<cstring>spinBoxIdentifyValue</cstring>
<string>Mouse wheel action:</string>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QDoubleSpinBox" name="spinBoxIdentifyValue" >
<property name="suffix" >
<string>%</string>
</property>
<property name="maximum" >
<double>100.000000000000000</double>
<item row="1" column="1" >
<widget class="QDoubleSpinBox" name="spinZoomFactor" >
<property name="decimals" >
<number>1</number>
</property>
<property name="singleStep" >
<double>0.010000000000000</double>
<property name="minimum" >
<double>1.100000000000000</double>
</property>
<property name="value" >
<double>5.000000000000000</double>
<double>2.000000000000000</double>
</property>
</widget>
</item>
@@ -488,6 +481,45 @@ p, li { white-space: pre-wrap; }
<property name="spacing" >
<number>6</number>
</property>
<item row="1" column="2" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>191</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1" >
<widget class="QgsColorButton" name="pbnMeasureColour" >
<property name="minimumSize" >
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="text" >
<string/>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2" >
<widget class="QComboBox" name="cmbEllipsoid" />
</item>
<item row="1" column="0" >
<widget class="QLabel" name="textLabel1_10" >
<property name="text" >
<string>Rubberband color:</string>
</property>
<property name="buddy" >
<cstring>cmbEllipsoid</cstring>
</property>
</widget>
</item>
<item row="0" column="0" >
<widget class="QLabel" name="textLabel1_8" >
<property name="text" >
@@ -498,16 +530,13 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QComboBox" name="cmbEllipsoid" />
</item>
</layout>
</widget>
</item>
<item row="2" column="0" >
<widget class="QGroupBox" name="groupBox_10" >
<item row="0" column="0" >
<widget class="QGroupBox" name="groupBox_7" >
<property name="title" >
<string>Panning and zooming</string>
<string>Search radius</string>
</property>
<layout class="QGridLayout" >
<property name="margin" >
@@ -516,55 +545,62 @@ p, li { white-space: pre-wrap; }
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="1" >
<widget class="QComboBox" name="cmbWheelAction" >
<item>
<property name="text" >
<string>Zoom</string>
</property>
</item>
<item>
<property name="text" >
<string>Zoom and recenter</string>
</property>
</item>
<item>
<property name="text" >
<string>Nothing</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="label_3" >
<item row="1" column="0" colspan="2" >
<widget class="QLabel" name="textLabel2" >
<property name="text" >
<string>Zoom factor:</string>
<string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
p, li { white-space: pre-wrap; }
&lt;/style>&lt;/head>&lt;body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;">
&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;span style=" font-weight:600;">Note:&lt;/span> Specify the search radius as a percentage of the map width.&lt;/p>
&lt;p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;/p>&lt;/body>&lt;/html></string>
</property>
<property name="wordWrap" >
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="0" >
<widget class="QLabel" name="label_2" >
<widget class="QLabel" name="textLabel1_3" >
<property name="text" >
<string>Mouse wheel action:</string>
<string>Search Radius for Identifying Features</string>
</property>
<property name="buddy" >
<cstring>spinBoxIdentifyValue</cstring>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QDoubleSpinBox" name="spinZoomFactor" >
<property name="decimals" >
<number>1</number>
<item row="0" column="1" >
<widget class="QDoubleSpinBox" name="spinBoxIdentifyValue" >
<property name="suffix" >
<string>%</string>
</property>
<property name="minimum" >
<double>1.100000000000000</double>
<property name="maximum" >
<double>100.000000000000000</double>
</property>
<property name="singleStep" >
<double>0.010000000000000</double>
</property>
<property name="value" >
<double>2.000000000000000</double>
<double>5.000000000000000</double>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="3" column="0" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="TabPage" >

0 comments on commit 0165846

Please sign in to comment.
You can’t perform that action at this time.