Skip to content
Permalink
Browse files

fix #1773

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@12555 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef
jef committed Dec 20, 2009
1 parent ad64e04 commit 09fe9a5add1bb2749bb8e313d85b817edc491e33
Showing with 6 additions and 44 deletions.
  1. +6 −44 src/app/attributetable/qgsattributetablemodel.cpp
@@ -62,30 +62,6 @@ void QgsAttributeTableModel::featureDeleted( int fid )
QgsDebugMsg( fid );
#endif

#if 0
--mFeatureCount;
mIdRowMap.remove( fid );
mRowIdMap.remove( idx );

// fill the hole in the view
if ( idx != mFeatureCount )
{
QgsDebugMsg( "jo" );
//mRowIdMap[idx] = mRowIdMap[mFeatureCount];
//mIdRowMap[mRowIdMap[idx]] = idx;
int movedId = mRowIdMap[mFeatureCount];
mRowIdMap.remove( mFeatureCount );
mRowIdMap.insert( idx, movedId );
mIdRowMap[movedId] = idx;
//mIdRowMap.remove(mRowIdMap[idx]);
//mIdRowMap.insert(mRowIdMap[idx], idx);
}

QgsDebugMsg( QString( "map sizes:%1, %2" ).arg( mRowIdMap.size() ).arg( mIdRowMap.size() ) );
emit layoutChanged();
//reload(index(0,0), index(rowCount(), columnCount()));
#endif

QgsDebugMsg( "id->row" );
QHash<int, int>::iterator it;
for ( it = mIdRowMap.begin(); it != mIdRowMap.end(); ++it )
@@ -259,18 +235,6 @@ void QgsAttributeTableModel::loadLayer()
endRemoveRows();
QgsDebugMsg( "end rm" );
}

#if 0
QgsDebugMsg( "id->row" );
QHash<int, int>::iterator it;
for ( it = mIdRowMap.begin(); it != mIdRowMap.end(); ++it )
QgsDebugMsg( QString( "%1->%2" ).arg( it.key() ).arg( *it ) );

QgsDebugMsg( "row->id" );

for ( it = mRowIdMap.begin(); it != mRowIdMap.end(); ++it )
QgsDebugMsg( QString( "%1->%2" ).arg( it.key() ).arg( *it ) );
#endif
}

void QgsAttributeTableModel::swapRows( int a, int b )
@@ -454,14 +418,6 @@ QVariant QgsAttributeTableModel::data( const QModelIndex &index, int role )
return mValueMaps[ index.column()]->key( val.toString(), QString( "(%1)" ).arg( val.toString() ) );
}

// force also numeric data for EditRole to be strings
// otherwise it creates spinboxes instead of line edits
// (probably not what we do want)
if ( fldNumeric && role == Qt::EditRole )
return val.toString();

// convert to QString from some other representation
// this prevents displaying greater numbers in exponential format
return val.toString();
}

@@ -480,9 +436,15 @@ bool QgsAttributeTableModel::setData( const QModelIndex &index, const QVariant &
mLastRowId = rowToId( index.row() );
mLastRow = ( QgsAttributeMap * ) & mFeat.attributeMap();

disconnect( mLayer, SIGNAL( layerModified( bool ) ), this, SLOT( layerModified( bool ) ) );

mLayer->beginEditCommand( tr( "Attribute changed" ) );
mLayer->changeAttributeValue( rowToId( index.row() ), mAttributes[ index.column()], value, true );
mLayer->endEditCommand();

( *mLastRow )[ mAttributes[index.column()] ] = value;

connect( mLayer, SIGNAL( layerModified( bool ) ), this, SLOT( layerModified( bool ) ) );
}

if ( !mLayer->isModified() )

0 comments on commit 09fe9a5

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