mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-03 00:02:25 -05:00
Make the rubber band color configurable
This commit is contained in:
parent
02fcaca693
commit
dad7aa70f6
@ -360,7 +360,16 @@ void QgsMapToolNodeTool::updateSelectFeature()
|
||||
|
||||
mSelectRubberBand = new QgsGeometryRubberBand( mCanvas, mSelectedFeature->geometry()->type() );
|
||||
mSelectRubberBand->setBrushStyle( Qt::SolidPattern );
|
||||
mSelectRubberBand->setFillColor( QColor( 255, 0, 0, 50 ) );
|
||||
|
||||
QSettings settings;
|
||||
QColor color(
|
||||
settings.value( "/qgis/digitizing/select_color_red", 255 ).toInt(),
|
||||
settings.value( "/qgis/digitizing/select_color_green", 0 ).toInt(),
|
||||
settings.value( "/qgis/digitizing/select_color_blue", 0 ).toInt() );
|
||||
double myAlpha = settings.value( "/qgis/digitizing/select_color_alpha", 30 ).toInt() / 255.0 ;
|
||||
color.setAlphaF( myAlpha );
|
||||
mSelectRubberBand->setFillColor( color );
|
||||
|
||||
QgsAbstractGeometryV2* rbGeom = mSelectedFeature->geometry()->geometry()->clone();
|
||||
QgsVectorLayer *vlayer = mSelectedFeature->vlayer();
|
||||
if ( mCanvas->mapSettings().layerTransform( vlayer ) )
|
||||
@ -489,6 +498,8 @@ void QgsMapToolNodeTool::canvasReleaseEvent( QgsMapMouseEvent* e )
|
||||
|
||||
mDeselectOnRelease = -1;
|
||||
}
|
||||
|
||||
updateSelectFeature();
|
||||
}
|
||||
|
||||
void QgsMapToolNodeTool::deactivate()
|
||||
|
@ -794,6 +794,15 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl ) :
|
||||
mLineColorToolButton->setContext( "gui" );
|
||||
mLineColorToolButton->setDefaultColor( QColor( 255, 0, 0, 200 ) );
|
||||
|
||||
myRed = settings.value( "/qgis/digitizing/fill_color_red", 255 ).toInt();
|
||||
myGreen = settings.value( "/qgis/digitizing/fill_color_green", 0 ).toInt();
|
||||
myBlue = settings.value( "/qgis/digitizing/fill_color_blue", 0 ).toInt();
|
||||
myAlpha = settings.value( "/qgis/digitizing/fill_color_alpha", 30 ).toInt();
|
||||
mFillColorToolButton->setColor( QColor( myRed, myGreen, myBlue, myAlpha ) );
|
||||
mFillColorToolButton->setAllowAlpha( true );
|
||||
mFillColorToolButton->setContext( "gui" );
|
||||
mFillColorToolButton->setDefaultColor( QColor( 255, 0, 0, 30 ) );
|
||||
|
||||
//default snap mode
|
||||
mDefaultSnapModeComboBox->insertItem( 0, tr( "To vertex" ), "to vertex" );
|
||||
mDefaultSnapModeComboBox->insertItem( 1, tr( "To segment" ), "to segment" );
|
||||
@ -1288,6 +1297,12 @@ void QgsOptions::saveOptions()
|
||||
settings.setValue( "/qgis/digitizing/line_color_blue", digitizingColor.blue() );
|
||||
settings.setValue( "/qgis/digitizing/line_color_alpha", digitizingColor.alpha() );
|
||||
|
||||
digitizingColor = mFillColorToolButton->color();
|
||||
settings.setValue( "/qgis/digitizing/fill_color_red", digitizingColor.red() );
|
||||
settings.setValue( "/qgis/digitizing/fill_color_green", digitizingColor.green() );
|
||||
settings.setValue( "/qgis/digitizing/fill_color_blue", digitizingColor.blue() );
|
||||
settings.setValue( "/qgis/digitizing/fill_color_alpha", digitizingColor.alpha() );
|
||||
|
||||
//default snap mode
|
||||
QString defaultSnapModeString = mDefaultSnapModeComboBox->itemData( mDefaultSnapModeComboBox->currentIndex() ).toString();
|
||||
settings.setValue( "/qgis/digitizing/default_snap_mode", defaultSnapModeString );
|
||||
|
@ -39,9 +39,10 @@ QgsRubberBand* QgsMapToolEdit::createRubberBand( QGis::GeometryType geometryType
|
||||
QSettings settings;
|
||||
QgsRubberBand* rb = new QgsRubberBand( mCanvas, geometryType );
|
||||
rb->setWidth( settings.value( "/qgis/digitizing/line_width", 1 ).toInt() );
|
||||
QColor color( settings.value( "/qgis/digitizing/line_color_red", 255 ).toInt(),
|
||||
settings.value( "/qgis/digitizing/line_color_green", 0 ).toInt(),
|
||||
settings.value( "/qgis/digitizing/line_color_blue", 0 ).toInt() );
|
||||
QColor color(
|
||||
settings.value( "/qgis/digitizing/line_color_red", 255 ).toInt(),
|
||||
settings.value( "/qgis/digitizing/line_color_green", 0 ).toInt(),
|
||||
settings.value( "/qgis/digitizing/line_color_blue", 0 ).toInt() );
|
||||
double myAlpha = settings.value( "/qgis/digitizing/line_color_alpha", 200 ).toInt() / 255.0;
|
||||
if ( alternativeBand )
|
||||
{
|
||||
@ -54,6 +55,15 @@ QgsRubberBand* QgsMapToolEdit::createRubberBand( QGis::GeometryType geometryType
|
||||
}
|
||||
color.setAlphaF( myAlpha );
|
||||
rb->setColor( color );
|
||||
|
||||
QColor fillColor(
|
||||
settings.value( "/qgis/digitizing/fill_color_red", 255 ).toInt(),
|
||||
settings.value( "/qgis/digitizing/fill_color_green", 0 ).toInt(),
|
||||
settings.value( "/qgis/digitizing/fill_color_blue", 0 ).toInt() );
|
||||
myAlpha = settings.value( "/qgis/digitizing/fill_color_alpha", 30 ).toInt() / 255.0 ;
|
||||
fillColor.setAlphaF( myAlpha );
|
||||
rb->setFillColor( fillColor );
|
||||
|
||||
rb->show();
|
||||
return rb;
|
||||
}
|
||||
|
@ -3558,6 +3558,32 @@
|
||||
<string>Rubberband</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="_9">
|
||||
<item row="0" column="9">
|
||||
<spacer name="horizontalSpacer_33">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="mLineWidthTextLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Line width</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="mLineColorTextLabel">
|
||||
<property name="sizePolicy">
|
||||
@ -3581,8 +3607,33 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="mLineWidthTextLabel">
|
||||
<item row="0" column="5">
|
||||
<widget class="QgsColorButtonV2" name="mFillColorToolButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<widget class="QLabel" name="mSelectColorTextLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
@ -3590,23 +3641,10 @@
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Line width</string>
|
||||
<string>Fill color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<spacer name="horizontalSpacer_33">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QgsColorButtonV2" name="mLineColorToolButton">
|
||||
<property name="sizePolicy">
|
||||
|
Loading…
x
Reference in New Issue
Block a user