Index: src/gui/symbology-ng/qgssymbollayerv2widget.h =================================================================== --- src/gui/symbology-ng/qgssymbollayerv2widget.h (revision 15829) +++ src/gui/symbology-ng/qgssymbollayerv2widget.h (working copy) @@ -4,6 +4,7 @@ #include +#define DEFAULT_SIMPLEFILL_STYLE Qt::SolidPattern class QgsSymbolLayerV2; @@ -80,6 +81,7 @@ void setName(); void setColorBorder(); void setColorFill(); + void setBrushStyle(); void setSize(); void setAngle(); void setOffset(); Index: src/gui/symbology-ng/qgssymbollayerv2widget.cpp =================================================================== --- src/gui/symbology-ng/qgssymbollayerv2widget.cpp (revision 15829) +++ src/gui/symbology-ng/qgssymbollayerv2widget.cpp (working copy) @@ -168,9 +168,10 @@ names << "circle" << "rectangle" << "diamond" << "pentagon" << "cross" << "cross2" << "triangle" << "equilateral_triangle" << "star" << "regular_star" << "arrow" << "line" << "arrowhead" << "filled_arrowhead"; double markerSize = DEFAULT_POINT_SIZE * 2; + Qt::BrushStyle brushStyle = DEFAULT_SIMPLEFILL_STYLE ; for ( int i = 0; i < names.count(); ++i ) { - QgsSimpleMarkerSymbolLayerV2* lyr = new QgsSimpleMarkerSymbolLayerV2( names[i], QColor( 200, 200, 200 ), QColor( 0, 0, 0 ), markerSize ); + QgsSimpleMarkerSymbolLayerV2* lyr = new QgsSimpleMarkerSymbolLayerV2( names[i], QColor( 200, 200, 200 ),brushStyle, QColor( 0, 0, 0 ), markerSize ); QIcon icon = QgsSymbolLayerV2Utils::symbolLayerPreviewIcon( lyr, QgsSymbolV2::MM, size ); QListWidgetItem* item = new QListWidgetItem( icon, QString(), lstNames ); item->setData( Qt::UserRole, names[i] ); @@ -182,6 +183,7 @@ connect( btnChangeColorFill, SIGNAL( clicked() ), this, SLOT( setColorFill() ) ); connect( spinSize, SIGNAL( valueChanged( double ) ), this, SLOT( setSize() ) ); connect( spinAngle, SIGNAL( valueChanged( double ) ), this, SLOT( setAngle() ) ); + connect( cboFillStyleMarker,SIGNAL( currentIndexChanged( int ) ), this, SLOT( setBrushStyle() )) ; connect( spinOffsetX, SIGNAL( valueChanged( double ) ), this, SLOT( setOffset() ) ); connect( spinOffsetY, SIGNAL( valueChanged( double ) ), this, SLOT( setOffset() ) ); } @@ -208,6 +210,7 @@ btnChangeColorFill->setColor( mLayer->color() ); spinSize->setValue( mLayer->size() ); spinAngle->setValue( mLayer->angle() ); + cboFillStyleMarker->setBrushStyle( mLayer->brushStyle() ); // without blocking signals the value gets changed because of slot setOffset() spinOffsetX->blockSignals( true ); @@ -259,6 +262,12 @@ emit changed(); } +void QgsSimpleMarkerSymbolLayerV2Widget::setBrushStyle() +{ + mLayer->setBrushStyle( cboFillStyleMarker->brushStyle() ); + emit changed(); +} + void QgsSimpleMarkerSymbolLayerV2Widget::setSize() { mLayer->setSize( spinSize->value() ); Index: src/core/symbology-ng/qgssymbologyv2conversion.cpp =================================================================== --- src/core/symbology-ng/qgssymbologyv2conversion.cpp (revision 15829) +++ src/core/symbology-ng/qgssymbologyv2conversion.cpp (working copy) @@ -32,7 +32,8 @@ QColor color = s->fillColor(); QColor borderColor = s->color(); QString name = symbolName.mid( 5 ); - sl = new QgsSimpleMarkerSymbolLayerV2( name, color, borderColor, size, angle ); + Qt::BrushStyle brushStyle = s->brush().style(); + sl = new QgsSimpleMarkerSymbolLayerV2( name, color, brushStyle, borderColor, size, angle ); } else { Index: src/core/symbology-ng/qgsmarkersymbollayerv2.h =================================================================== --- src/core/symbology-ng/qgsmarkersymbollayerv2.h (revision 15829) +++ src/core/symbology-ng/qgsmarkersymbollayerv2.h (working copy) @@ -6,6 +6,7 @@ #define DEFAULT_SIMPLEMARKER_NAME "circle" #define DEFAULT_SIMPLEMARKER_COLOR QColor(255,0,0) +#define DEFAULT_SIMPLEMARKER_STYLE Qt::SolidPattern #define DEFAULT_SIMPLEMARKER_BORDERCOLOR QColor(0,0,0) #define DEFAULT_SIMPLEMARKER_SIZE DEFAULT_POINT_SIZE #define DEFAULT_SIMPLEMARKER_ANGLE 0 @@ -21,6 +22,7 @@ public: QgsSimpleMarkerSymbolLayerV2( QString name = DEFAULT_SIMPLEMARKER_NAME, QColor color = DEFAULT_SIMPLEMARKER_COLOR, + Qt::BrushStyle style = DEFAULT_SIMPLEMARKER_STYLE, QColor borderColor = DEFAULT_SIMPLEMARKER_BORDERCOLOR, double size = DEFAULT_SIMPLEMARKER_SIZE, double angle = DEFAULT_SIMPLEMARKER_ANGLE ); @@ -42,6 +44,9 @@ QgsStringMap properties() const; QgsSymbolLayerV2* clone() const; + + Qt::BrushStyle brushStyle() const { return mBrushStyle; } + void setBrushStyle( Qt::BrushStyle style ) { mBrushStyle = style; } QString name() const { return mName; } void setName( QString name ) { mName = name; } @@ -64,6 +69,7 @@ QPolygonF mPolygon; QPainterPath mPath; QString mName; + Qt::BrushStyle mBrushStyle; QImage mCache; QPen mSelPen; QBrush mSelBrush; Index: src/core/symbology-ng/qgsmarkersymbollayerv2.cpp =================================================================== --- src/core/symbology-ng/qgsmarkersymbollayerv2.cpp (revision 15829) +++ src/core/symbology-ng/qgsmarkersymbollayerv2.cpp (working copy) @@ -31,13 +31,14 @@ ////// -QgsSimpleMarkerSymbolLayerV2::QgsSimpleMarkerSymbolLayerV2( QString name, QColor color, QColor borderColor, double size, double angle ) +QgsSimpleMarkerSymbolLayerV2::QgsSimpleMarkerSymbolLayerV2( QString name, QColor color, Qt::BrushStyle style, QColor borderColor, double size, double angle ) { mName = name; mColor = color; mBorderColor = borderColor; mSize = size; mAngle = angle; + mBrushStyle = style; mOffset = QPointF( 0, 0 ); } @@ -45,6 +46,7 @@ { QString name = DEFAULT_SIMPLEMARKER_NAME; QColor color = DEFAULT_SIMPLEMARKER_COLOR; + Qt::BrushStyle style = DEFAULT_SIMPLEMARKER_STYLE; QColor borderColor = DEFAULT_SIMPLEMARKER_BORDERCOLOR; double size = DEFAULT_SIMPLEMARKER_SIZE; double angle = DEFAULT_SIMPLEMARKER_ANGLE; @@ -53,6 +55,8 @@ name = props["name"]; if ( props.contains( "color" ) ) color = QgsSymbolLayerV2Utils::decodeColor( props["color"] ); + if ( props.contains( "style" ) ) + style = QgsSymbolLayerV2Utils::decodeBrushStyle( props["style"] ); if ( props.contains( "color_border" ) ) borderColor = QgsSymbolLayerV2Utils::decodeColor( props["color_border"] ); if ( props.contains( "size" ) ) @@ -60,7 +64,7 @@ if ( props.contains( "angle" ) ) angle = props["angle"].toDouble(); - QgsSimpleMarkerSymbolLayerV2* m = new QgsSimpleMarkerSymbolLayerV2( name, color, borderColor, size, angle ); + QgsSimpleMarkerSymbolLayerV2* m = new QgsSimpleMarkerSymbolLayerV2( name, color, style, borderColor, size, angle ); if ( props.contains( "offset" ) ) m->setOffset( QgsSymbolLayerV2Utils::decodePoint( props["offset"] ) ); return m; @@ -75,16 +79,21 @@ void QgsSimpleMarkerSymbolLayerV2::startRender( QgsSymbolV2RenderContext& context ) { QColor brushColor = mColor; + mBrush = QBrush( mColor, mBrushStyle ); QColor penColor = mBorderColor; if ( context.alpha() < 1 ) { penColor.setAlphaF( context.alpha() ); brushColor.setAlphaF( context.alpha() ); } - mBrush = QBrush( brushColor ); mPen = QPen( penColor ); mPen.setWidthF( context.outputLineWidth( mPen.widthF() ) ); + QColor selColor = context.selectionColor(); + selColor.setAlphaF( context.alpha() ); + mSelBrush = QBrush( selColor ); + if ( selectFillStyle ) mSelBrush.setStyle( mBrushStyle ); + QColor selBrushColor = context.selectionColor(); QColor selPenColor = selBrushColor == mColor ? selBrushColor : mBorderColor; if ( context.alpha() < 1 ) @@ -410,6 +419,7 @@ QgsStringMap map; map["name"] = mName; map["color"] = QgsSymbolLayerV2Utils::encodeColor( mColor ); + map["style"] = QgsSymbolLayerV2Utils::encodeBrushStyle( mBrushStyle ); map["color_border"] = QgsSymbolLayerV2Utils::encodeColor( mBorderColor ); map["size"] = QString::number( mSize ); map["angle"] = QString::number( mAngle ); @@ -419,7 +429,7 @@ QgsSymbolLayerV2* QgsSimpleMarkerSymbolLayerV2::clone() const { - QgsSimpleMarkerSymbolLayerV2* m = new QgsSimpleMarkerSymbolLayerV2( mName, mColor, mBorderColor, mSize, mAngle ); + QgsSimpleMarkerSymbolLayerV2* m = new QgsSimpleMarkerSymbolLayerV2( mName, mColor, mBrushStyle, mBorderColor, mSize, mAngle ); m->setOffset( mOffset ); return m; } Index: src/ui/symbollayer/widget_simplemarker.ui =================================================================== --- src/ui/symbollayer/widget_simplemarker.ui (revision 15829) +++ src/ui/symbollayer/widget_simplemarker.ui (working copy) @@ -7,7 +7,7 @@ 0 0 394 - 275 + 305 @@ -60,21 +60,21 @@ - + Size - + Angle - + 1 @@ -87,14 +87,14 @@ - + Offset X,Y - + @@ -118,7 +118,7 @@ - + 2 @@ -131,6 +131,16 @@ + + + + Fill Style + + + + + + @@ -156,9 +166,6 @@ QListView::LeftToRight - - QListView::Adjust - 4 @@ -196,6 +203,11 @@ + Q3ComboBox + QWidget +
Qt3Support/Q3ComboBox
+
+ QgsColorButtonV2 QPushButton
qgscolorbutton.h