Skip to content
Permalink
Browse files

Better default values for gradient fills

  • Loading branch information
nyalldawson committed Nov 3, 2013
1 parent dfba26d commit eeea36e6953db4a1fb737307ccc6adb9c4ef962c
@@ -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 )
@@ -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;
@@ -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();
@@ -207,6 +207,9 @@
<property name="singleStep">
<double>0.100000000000000</double>
</property>
<property name="value">
<double>0.500000000000000</double>
</property>
</widget>
</item>
<item>
@@ -276,7 +279,7 @@
<double>0.100000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
<double>0.500000000000000</double>
</property>
</widget>
</item>

0 comments on commit eeea36e

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