Navigation Menu

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/qgis@9180 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Aug 27, 2008
1 parent 5a0c4cf commit 203f0e5
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion src/app/qgsattributetable.cpp
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 203f0e5

Please sign in to comment.