Skip to content

Commit

Permalink
fix handling of null value updates in attribute table
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@9180 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Aug 27, 2008
1 parent 1797520 commit c4c4cc2
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion src/app/qgsattributetable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,31 @@ void QgsAttributeTable::attributeValueChanged( int fid, int idx, const QVariant
if ( !mAttrIdxMap.contains( idx ) )
return;

item( rowIdMap[fid], mAttrIdxMap[idx] )->setText( value.toString() );
QTableWidgetItem *twi = horizontalHeaderItem( mAttrIdxMap[ idx ] );
if ( !twi )
{
QgsDebugMsg( "header item not found." );
return;
}

int type = twi->data( AttributeType ).toInt();
bool isNum = ( type == QVariant::Double || type == QVariant::Int );

QString v;
// get the field values
if ( value.isNull() )
{
if ( isNum )
v = "";
else
v = "NULL";
}
else
{
v = value.toString();
}

item( rowIdMap[fid], mAttrIdxMap[idx] )->setText( v );
}

void QgsAttributeTable::featureDeleted( int fid )
Expand Down

0 comments on commit c4c4cc2

Please sign in to comment.