Skip to content

Commit

Permalink
Nicer preview symbols for patches
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Apr 22, 2020
1 parent ec2894e commit 9327ea6
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/core/symbology/qgsstyle.cpp
Expand Up @@ -25,6 +25,9 @@
#include "qgslegendpatchshape.h"
#include "qgslinestring.h"
#include "qgspolygon.h"
#include "qgsmarkersymbollayer.h"
#include "qgslinesymbollayer.h"
#include "qgsfillsymbollayer.h"

#include <QDomDocument>
#include <QDomElement>
Expand Down Expand Up @@ -55,9 +58,17 @@ QgsStyle *QgsStyle::sDefaultStyle = nullptr;

QgsStyle::QgsStyle()
{
mPatchMarkerSymbol.reset( QgsMarkerSymbol::createSimple( QgsStringMap() ) );
mPatchLineSymbol.reset( QgsLineSymbol::createSimple( QgsStringMap() ) );
mPatchFillSymbol.reset( QgsFillSymbol::createSimple( QgsStringMap() ) );
std::unique_ptr< QgsSimpleMarkerSymbolLayer > simpleMarker = qgis::make_unique< QgsSimpleMarkerSymbolLayer >( QgsSimpleMarkerSymbolLayerBase::Circle,
1.6, 0, QgsSymbol::ScaleArea, QColor( 84, 176, 74 ), QColor( 61, 128, 53 ) );
simpleMarker->setStrokeWidth( 0.4 );
mPatchMarkerSymbol = qgis::make_unique< QgsMarkerSymbol >( QgsSymbolLayerList() << simpleMarker.release() );

std::unique_ptr< QgsSimpleLineSymbolLayer > simpleLine = qgis::make_unique< QgsSimpleLineSymbolLayer >( QColor( 84, 176, 74 ), 0.6 );
mPatchLineSymbol = qgis::make_unique< QgsLineSymbol >( QgsSymbolLayerList() << simpleLine.release() );

std::unique_ptr< QgsGradientFillSymbolLayer > gradientFill = qgis::make_unique< QgsGradientFillSymbolLayer >( QColor( 66, 150, 63 ), QColor( 84, 176, 74 ) );
std::unique_ptr< QgsSimpleLineSymbolLayer > simpleOutline = qgis::make_unique< QgsSimpleLineSymbolLayer >( QColor( 56, 128, 54 ), 0.26 );
mPatchFillSymbol = qgis::make_unique< QgsFillSymbol >( QgsSymbolLayerList() << gradientFill.release() << simpleOutline.release() );
}

QgsStyle::~QgsStyle()
Expand Down

0 comments on commit 9327ea6

Please sign in to comment.