Skip to content

Commit

Permalink
Better default values for gradient fills
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Nov 3, 2013
1 parent dfba26d commit eeea36e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/core/symbology-ng/qgsfillsymbollayerv2.cpp
Expand Up @@ -293,9 +293,9 @@ QgsGradientFillSymbolLayerV2::QgsGradientFillSymbolLayerV2( QColor color, QColor
mGradientType( gradientType ),
mCoordinateMode( coordinateMode ),
mGradientSpread( spread ),
mReferencePoint1( QPointF( 0, 0 ) ),
mReferencePoint1( QPointF( 0.5, 0 ) ),
mReferencePoint1IsCentroid( false ),
mReferencePoint2( QPointF( 1, 1 ) ),
mReferencePoint2( QPointF( 0.5, 1 ) ),
mReferencePoint2IsCentroid( false ),
mAngle( 0 ),
mOffsetUnit( QgsSymbolV2::MM )
Expand All @@ -318,9 +318,9 @@ QgsSymbolLayerV2* QgsGradientFillSymbolLayerV2::create( const QgsStringMap& prop
GradientSpread gradientSpread = QgsGradientFillSymbolLayerV2::Pad;
//default to gradient from the default fill color to white
QColor color = DEFAULT_SIMPLEFILL_COLOR, color2 = Qt::white;
QPointF referencePoint1 = QPointF( 0, 0 );
QPointF referencePoint1 = QPointF( 0.5, 0 );
bool refPoint1IsCentroid = false;
QPointF referencePoint2 = QPointF( 1, 1 );
QPointF referencePoint2 = QPointF( 0.5, 1 );
bool refPoint2IsCentroid = false;
double angle = 0;
QPointF offset;
Expand Down
14 changes: 14 additions & 0 deletions src/gui/symbology-ng/qgssymbollayerv2widget.cpp
Expand Up @@ -813,12 +813,26 @@ void QgsGradientFillSymbolLayerV2Widget::setGradientType( int index )
{
case 0:
mLayer->setGradientType( QgsGradientFillSymbolLayerV2::Linear );
//set sensible default reference points
spinRefPoint1X->setValue( 0.5 );
spinRefPoint1Y->setValue( 0 );
spinRefPoint2X->setValue( 0.5 );
spinRefPoint2Y->setValue( 1 );
break;
case 1:
mLayer->setGradientType( QgsGradientFillSymbolLayerV2::Radial );
//set sensible default reference points
spinRefPoint1X->setValue( 0 );
spinRefPoint1Y->setValue( 0 );
spinRefPoint2X->setValue( 1 );
spinRefPoint2Y->setValue( 1 );
break;
case 2:
mLayer->setGradientType( QgsGradientFillSymbolLayerV2::Conical );
spinRefPoint1X->setValue( 0.5 );
spinRefPoint1Y->setValue( 0.5 );
spinRefPoint2X->setValue( 1 );
spinRefPoint2Y->setValue( 1 );
break;
}
emit changed();
Expand Down
5 changes: 4 additions & 1 deletion src/ui/symbollayer/widget_gradientfill.ui
Expand Up @@ -207,6 +207,9 @@
<property name="singleStep">
<double>0.100000000000000</double>
</property>
<property name="value">
<double>0.500000000000000</double>
</property>
</widget>
</item>
<item>
Expand Down Expand Up @@ -276,7 +279,7 @@
<double>0.100000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
<double>0.500000000000000</double>
</property>
</widget>
</item>
Expand Down

0 comments on commit eeea36e

Please sign in to comment.