Skip to content

Commit

Permalink
Merge pull request #3147 from pblottiere/fix_diagram
Browse files Browse the repository at this point in the history
[Bugfix] Fix pin/unpin maptool
  • Loading branch information
3nids committed May 30, 2016
2 parents 72b55b7 + 62c814c commit 12cbcfc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 5 additions & 1 deletion src/app/qgsmaptoollabel.cpp
Expand Up @@ -689,7 +689,11 @@ QgsMapToolLabel::LabelDetails::LabelDetails( const QgsLabelPosition& p )
if ( layer && layer->labeling() )
{
settings = layer->labeling()->settings( layer, pos.providerID );
valid = settings.enabled;

if ( p.isDiagram )
valid = layer->diagramsEnabled();
else
valid = settings.enabled;
}

if ( !valid )
Expand Down
5 changes: 2 additions & 3 deletions src/app/qgsmaptoolpinlabels.cpp
Expand Up @@ -239,8 +239,6 @@ void QgsMapToolPinLabels::pinUnpinLabels( const QgsRectangle& ext, QMouseEvent *
bool toggleUnpinOrPin = e->modifiers() & Qt::ControlModifier;

// get list of all drawn labels from all layers within, or touching, chosen extent
bool labelChanged = false;

const QgsLabelingResults* labelingResults = mCanvas->labelingResults();
if ( !labelingResults )
{
Expand All @@ -250,6 +248,7 @@ void QgsMapToolPinLabels::pinUnpinLabels( const QgsRectangle& ext, QMouseEvent *

QList<QgsLabelPosition> labelPosList = labelingResults->labelsWithinRect( ext );

bool labelChanged = false;
QList<QgsLabelPosition>::const_iterator it;
for ( it = labelPosList.constBegin() ; it != labelPosList.constEnd(); ++it )
{
Expand Down Expand Up @@ -284,7 +283,7 @@ void QgsMapToolPinLabels::pinUnpinLabels( const QgsRectangle& ext, QMouseEvent *
}
}
// pin label
if ( !isPinned() && ( !doUnpin || toggleUnpinOrPin ) )
else if ( !isPinned() && ( !doUnpin || toggleUnpinOrPin ) )
{
// pin label's location, and optionally rotation, to attribute table
if ( pinUnpinCurrentFeature( true ) )
Expand Down

0 comments on commit 12cbcfc

Please sign in to comment.