Skip to content
Permalink
Browse files

Fix show/hide labels tool with postgres (followup 0232819)

  • Loading branch information
wonder-sk committed May 3, 2016
1 parent ccebd83 commit 98e9ae14f54f4e9dcd871fa73b076ac3e72dd3b8
Showing with 7 additions and 3 deletions.
  1. +7 −3 src/app/qgsmaptoolshowhidelabels.cpp
@@ -288,21 +288,25 @@ bool QgsMapToolShowHideLabels::showHide( QgsVectorLayer *vl, const bool show )
return false;
}

// we need to pass int value to the provider
// (committing bool value would fail on int field)
int curVal = show ? 1 : 0;

// check if attribute value is already the same
if ( showSuccess && ( showVal != 0 ) == show )
if ( showSuccess && showVal == curVal )
{
return false;
}

// allow NULL (maybe default) value to stand for show label (i.e. 1)
// skip NULL attributes if trying to show label
if ( !showSuccess && show == 1 )
if ( !showSuccess && curVal == 1 )
{
return false;
}

// different attribute value, edit table
if ( ! vl->changeAttributeValue( mCurrentLabel.pos.featureId, showCol, show ) )
if ( ! vl->changeAttributeValue( mCurrentLabel.pos.featureId, showCol, curVal ) )
{
QgsDebugMsg( "Failed write to attribute table" );
return false;

1 comment on commit 98e9ae1

@3nids

This comment has been minimized.

Copy link
Member

@3nids 3nids commented on 98e9ae1 May 3, 2016

Thanks !!!

Please sign in to comment.
You can’t perform that action at this time.