Skip to content

Commit

Permalink
Correctly return null values from QgsColorWidgetWrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed May 24, 2016
1 parent 58e1c7f commit 94d88e6
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/gui/editorwidgets/qgscolorwidgetwrapper.cpp
Expand Up @@ -25,12 +25,11 @@ QgsColorWidgetWrapper::QgsColorWidgetWrapper( QgsVectorLayer* vl, int fieldIdx,

QVariant QgsColorWidgetWrapper::value() const
{
QVariant v;

QColor c;
if ( mColorButton )
v = mColorButton->color();
c = mColorButton->color();

return v;
return c.isValid() ? QVariant( c ) : QVariant( QVariant::Color );
}

void QgsColorWidgetWrapper::showIndeterminateState()
Expand Down Expand Up @@ -76,5 +75,5 @@ bool QgsColorWidgetWrapper::valid() const
void QgsColorWidgetWrapper::setValue( const QVariant& value )
{
if ( mColorButton )
mColorButton->setColor( QColor( value.toString() ) );
mColorButton->setColor( !value.isNull() ? QColor( value.toString() ) : QColor() );
}

0 comments on commit 94d88e6

Please sign in to comment.