Skip to content
Permalink
Browse files
fix handling of null value updates in attribute table
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 c4c4cc266f0b7259c15b14d9d4c11b709fac0dbd
Showing with 25 additions and 1 deletion.
  1. +25 −1 src/app/qgsattributetable.cpp
@@ -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 )

0 comments on commit c4c4cc2

Please sign in to comment.