@@ -166,6 +166,7 @@ QgsVectorLayerProperties::QgsVectorLayerProperties(
166166
167167void QgsVectorLayerProperties::loadRows ()
168168{
169+ QObject::disconnect ( tblAttributes, SIGNAL ( cellChanged ( int , int ) ), this , SLOT ( on_tblAttributes_cellChanged ( int , int ) ) );
169170 const QgsFieldMap &fields = layer->pendingFields ();
170171
171172 tblAttributes->clear ();
@@ -191,6 +192,7 @@ void QgsVectorLayerProperties::loadRows()
191192 setRow ( row, it.key (), it.value () );
192193
193194 tblAttributes->resizeColumnsToContents ();
195+ QObject::connect ( tblAttributes, SIGNAL ( cellChanged ( int , int ) ), this , SLOT ( on_tblAttributes_cellChanged ( int , int ) ) );
194196}
195197
196198void QgsVectorLayerProperties::setRow ( int row, int idx, const QgsField &field )
@@ -382,7 +384,7 @@ void QgsVectorLayerProperties::deleteAttribute()
382384
383385void QgsVectorLayerProperties::editingToggled ()
384386{
385- if ( layer->isEditable () )
387+ if ( ! layer->isEditable () )
386388 loadRows ();
387389
388390 updateButtons ();
@@ -1200,11 +1202,7 @@ void QgsVectorLayerProperties::on_mButtonAddJoin_clicked()
12001202 }
12011203
12021204 layer->addJoin ( info );
1203-
1204- // prevent complete redraw for each row
1205- QObject::disconnect ( tblAttributes, SIGNAL ( cellChanged ( int , int ) ), this , SLOT ( on_tblAttributes_cellChanged ( int , int ) ) );
12061205 loadRows (); // update attribute tab
1207- QObject::connect ( tblAttributes, SIGNAL ( cellChanged ( int , int ) ), this , SLOT ( on_tblAttributes_cellChanged ( int , int ) ) );
12081206 addJoinToTreeWidget ( info );
12091207 }
12101208 }
@@ -1241,11 +1239,7 @@ void QgsVectorLayerProperties::on_mButtonRemoveJoin_clicked()
12411239 }
12421240
12431241 layer->removeJoin ( currentJoinItem->data ( 0 , Qt::UserRole ).toString () );
1244-
1245- // prevent complete redraw for each row
1246- QObject::disconnect ( tblAttributes, SIGNAL ( cellChanged ( int , int ) ), this , SLOT ( on_tblAttributes_cellChanged ( int , int ) ) );
12471242 loadRows ();
1248- QObject::connect ( tblAttributes, SIGNAL ( cellChanged ( int , int ) ), this , SLOT ( on_tblAttributes_cellChanged ( int , int ) ) );
12491243 mJoinTreeWidget ->takeTopLevelItem ( mJoinTreeWidget ->indexOfTopLevelItem ( currentJoinItem ) );
12501244}
12511245
0 commit comments