Skip to content

Commit 12cbcfc

Browse files
committed
Merge pull request #3147 from pblottiere/fix_diagram
[Bugfix] Fix pin/unpin maptool
2 parents 72b55b7 + 62c814c commit 12cbcfc

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/app/qgsmaptoollabel.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,11 @@ QgsMapToolLabel::LabelDetails::LabelDetails( const QgsLabelPosition& p )
689689
if ( layer && layer->labeling() )
690690
{
691691
settings = layer->labeling()->settings( layer, pos.providerID );
692-
valid = settings.enabled;
692+
693+
if ( p.isDiagram )
694+
valid = layer->diagramsEnabled();
695+
else
696+
valid = settings.enabled;
693697
}
694698

695699
if ( !valid )

src/app/qgsmaptoolpinlabels.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,6 @@ void QgsMapToolPinLabels::pinUnpinLabels( const QgsRectangle& ext, QMouseEvent *
239239
bool toggleUnpinOrPin = e->modifiers() & Qt::ControlModifier;
240240

241241
// get list of all drawn labels from all layers within, or touching, chosen extent
242-
bool labelChanged = false;
243-
244242
const QgsLabelingResults* labelingResults = mCanvas->labelingResults();
245243
if ( !labelingResults )
246244
{
@@ -250,6 +248,7 @@ void QgsMapToolPinLabels::pinUnpinLabels( const QgsRectangle& ext, QMouseEvent *
250248

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

251+
bool labelChanged = false;
253252
QList<QgsLabelPosition>::const_iterator it;
254253
for ( it = labelPosList.constBegin() ; it != labelPosList.constEnd(); ++it )
255254
{
@@ -284,7 +283,7 @@ void QgsMapToolPinLabels::pinUnpinLabels( const QgsRectangle& ext, QMouseEvent *
284283
}
285284
}
286285
// pin label
287-
if ( !isPinned() && ( !doUnpin || toggleUnpinOrPin ) )
286+
else if ( !isPinned() && ( !doUnpin || toggleUnpinOrPin ) )
288287
{
289288
// pin label's location, and optionally rotation, to attribute table
290289
if ( pinUnpinCurrentFeature( true ) )

0 commit comments

Comments
 (0)