Skip to content

Commit

Permalink
Fix data defined buttons sometimes incorrectly show error state
Browse files Browse the repository at this point in the history
(cherry-picked from 7d27b43)
  • Loading branch information
nyalldawson committed Oct 6, 2016
1 parent 7c46784 commit e6df7e3
Showing 1 changed file with 38 additions and 41 deletions.
79 changes: 38 additions & 41 deletions src/gui/qgshighlight.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,65 +280,62 @@ void QgsHighlight::paint( QPainter* p )
p->setPen( mPen );
p->setBrush( mBrush );

switch ( mGeometry->wkbType() )
switch ( mGeometry->type() )
{
case QGis::WKBPoint:
case QGis::WKBPoint25D:
case QGis::PointGeometry:
{
paintPoint( p, mGeometry->asPoint() );
}
break;

case QGis::WKBMultiPoint:
case QGis::WKBMultiPoint25D:
{
QgsMultiPoint m = mGeometry->asMultiPoint();
for ( int i = 0; i < m.size(); i++ )
if ( !mGeometry->isMultipart() )
{
paintPoint( p, m[i] );
paintPoint( p, mGeometry->asPoint() );
}
else
{
QgsMultiPoint m = mGeometry->asMultiPoint();
for ( int i = 0; i < m.size(); i++ )
{
paintPoint( p, m[i] );
}
}
}
break;

case QGis::WKBLineString:
case QGis::WKBLineString25D:
{
paintLine( p, mGeometry->asPolyline() );
}
break;

case QGis::WKBMultiLineString:
case QGis::WKBMultiLineString25D:
case QGis::LineGeometry:
{
QgsMultiPolyline m = mGeometry->asMultiPolyline();

for ( int i = 0; i < m.size(); i++ )
if ( !mGeometry->isMultipart() )
{
paintLine( p, m[i] );
paintLine( p, mGeometry->asPolyline() );
}
}
break;
else
{
QgsMultiPolyline m = mGeometry->asMultiPolyline();

case QGis::WKBPolygon:
case QGis::WKBPolygon25D:
{
paintPolygon( p, mGeometry->asPolygon() );
for ( int i = 0; i < m.size(); i++ )
{
paintLine( p, m[i] );
}
}
break;
}
break;

case QGis::WKBMultiPolygon:
case QGis::WKBMultiPolygon25D:
case QGis::PolygonGeometry:
{
QgsMultiPolygon m = mGeometry->asMultiPolygon();
for ( int i = 0; i < m.size(); i++ )
if ( !mGeometry->isMultipart() )
{
paintPolygon( p, mGeometry->asPolygon() );
}
else
{
paintPolygon( p, m[i] );
QgsMultiPolygon m = mGeometry->asMultiPolygon();
for ( int i = 0; i < m.size(); i++ )
{
paintPolygon( p, m[i] );
}
}
break;
}
break;

case QGis::WKBUnknown:
default:
case QGis::UnknownGeometry:
case QGis::NullGeometry:
return;
}
}
Expand Down

0 comments on commit e6df7e3

Please sign in to comment.