Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Change default label buffer join style to round
Looks much nicer and is more appropriate for buffers

(cherry-picked from 4dbea7f)
  • Loading branch information
nyalldawson committed Sep 26, 2016
1 parent f9d258d commit 0ebf09e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/core/qgspallabeling.cpp
Expand Up @@ -151,7 +151,7 @@ QgsPalLayerSettings::QgsPalLayerSettings()
bufferColor = Qt::white;
bufferTransp = 0;
bufferNoFill = false;
bufferJoinStyle = Qt::BevelJoin;
bufferJoinStyle = Qt::RoundJoin;
bufferBlendMode = QPainter::CompositionMode_SourceOver;

// shape background
Expand Down Expand Up @@ -909,7 +909,7 @@ void QgsPalLayerSettings::readFromLayer( QgsVectorLayer* layer )
bufferTransp = layer->customProperty( "labeling/bufferTransp" ).toInt();
bufferBlendMode = QgsMapRenderer::getCompositionMode(
static_cast< QgsMapRenderer::BlendMode >( layer->customProperty( "labeling/bufferBlendMode", QVariant( QgsMapRenderer::BlendNormal ) ).toUInt() ) );
bufferJoinStyle = static_cast< Qt::PenJoinStyle >( layer->customProperty( "labeling/bufferJoinStyle", QVariant( Qt::BevelJoin ) ).toUInt() );
bufferJoinStyle = static_cast< Qt::PenJoinStyle >( layer->customProperty( "labeling/bufferJoinStyle", QVariant( Qt::RoundJoin ) ).toUInt() );
bufferNoFill = layer->customProperty( "labeling/bufferNoFill", QVariant( false ) ).toBool();

// background
Expand Down Expand Up @@ -1371,7 +1371,7 @@ void QgsPalLayerSettings::readXml( QDomElement& elem )
bufferTransp = textBufferElem.attribute( "bufferTransp" ).toInt();
bufferBlendMode = QgsMapRenderer::getCompositionMode(
static_cast< QgsMapRenderer::BlendMode >( textBufferElem.attribute( "bufferBlendMode", QString::number( QgsMapRenderer::BlendNormal ) ).toUInt() ) );
bufferJoinStyle = static_cast< Qt::PenJoinStyle >( textBufferElem.attribute( "bufferJoinStyle", QString::number( Qt::BevelJoin ) ).toUInt() );
bufferJoinStyle = static_cast< Qt::PenJoinStyle >( textBufferElem.attribute( "bufferJoinStyle", QString::number( Qt::RoundJoin ) ).toUInt() );
bufferNoFill = textBufferElem.attribute( "bufferNoFill", "0" ).toInt();

// background
Expand Down
3 changes: 2 additions & 1 deletion tests/src/python/test_qgspallabeling_base.py
Expand Up @@ -29,7 +29,7 @@
import shutil
import tempfile

from qgis.PyQt.QtCore import QSize, qDebug
from qgis.PyQt.QtCore import QSize, qDebug, Qt
from qgis.PyQt.QtGui import QFont, QColor

from qgis.core import (
Expand Down Expand Up @@ -266,6 +266,7 @@ def defaultLayerSettings(self):
font.setPointSize(32)
lyr.textFont = font
lyr.textNamedStyle = 'Roman'
lyr.bufferJoinStyle = Qt.BevelJoin # handle change of default join style
return lyr

@staticmethod
Expand Down

0 comments on commit 0ebf09e

Please sign in to comment.