Skip to content

Commit

Permalink
Fewer redraws if toggeling editing from vector props
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@15173 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Feb 15, 2011
1 parent 3374f38 commit 8e0e6f4
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/app/qgsvectorlayerproperties.cpp
Expand Up @@ -166,6 +166,7 @@ QgsVectorLayerProperties::QgsVectorLayerProperties(

void QgsVectorLayerProperties::loadRows()
{
QObject::disconnect( tblAttributes, SIGNAL( cellChanged( int, int ) ), this, SLOT( on_tblAttributes_cellChanged( int, int ) ) );
const QgsFieldMap &fields = layer->pendingFields();

tblAttributes->clear();
Expand All @@ -191,6 +192,7 @@ void QgsVectorLayerProperties::loadRows()
setRow( row, it.key(), it.value() );

tblAttributes->resizeColumnsToContents();
QObject::connect( tblAttributes, SIGNAL( cellChanged( int, int ) ), this, SLOT( on_tblAttributes_cellChanged( int, int ) ) );
}

void QgsVectorLayerProperties::setRow( int row, int idx, const QgsField &field )
Expand Down Expand Up @@ -382,7 +384,7 @@ void QgsVectorLayerProperties::deleteAttribute()

void QgsVectorLayerProperties::editingToggled()
{
if ( layer->isEditable() )
if ( !layer->isEditable() )
loadRows();

updateButtons();
Expand Down Expand Up @@ -1200,11 +1202,7 @@ void QgsVectorLayerProperties::on_mButtonAddJoin_clicked()
}

layer->addJoin( info );

//prevent complete redraw for each row
QObject::disconnect( tblAttributes, SIGNAL( cellChanged( int, int ) ), this, SLOT( on_tblAttributes_cellChanged( int, int ) ) );
loadRows(); //update attribute tab
QObject::connect( tblAttributes, SIGNAL( cellChanged( int, int ) ), this, SLOT( on_tblAttributes_cellChanged( int, int ) ) );
addJoinToTreeWidget( info );
}
}
Expand Down Expand Up @@ -1241,11 +1239,7 @@ void QgsVectorLayerProperties::on_mButtonRemoveJoin_clicked()
}

layer->removeJoin( currentJoinItem->data( 0, Qt::UserRole ).toString() );

//prevent complete redraw for each row
QObject::disconnect( tblAttributes, SIGNAL( cellChanged( int, int ) ), this, SLOT( on_tblAttributes_cellChanged( int, int ) ) );
loadRows();
QObject::connect( tblAttributes, SIGNAL( cellChanged( int, int ) ), this, SLOT( on_tblAttributes_cellChanged( int, int ) ) );
mJoinTreeWidget->takeTopLevelItem( mJoinTreeWidget->indexOfTopLevelItem( currentJoinItem ) );
}

Expand Down

0 comments on commit 8e0e6f4

Please sign in to comment.