Skip to content
Permalink
Browse files

Correctly return null values from QgsColorWidgetWrapper

(cherry-picked from 94d88e6)
  • Loading branch information
nyalldawson committed May 25, 2016
1 parent 0234cd2 commit 41a98ca96d9cfecbc54102fb0be8b12781af7624
Showing with 4 additions and 5 deletions.
  1. +4 −5 src/gui/editorwidgets/qgscolorwidgetwrapper.cpp
@@ -24,12 +24,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 );
}

QWidget* QgsColorWidgetWrapper::createWidget( QWidget* parent )
@@ -54,5 +53,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 41a98ca

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