Skip to content

Commit 57b82b9

Browse files
author
jef
committed
let attribute table follow canvas extent
git-svn-id: http://svn.osgeo.org/qgis/trunk@13551 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 0336b6d commit 57b82b9

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

src/app/attributetable/qgsattributetabledialog.cpp

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,7 @@ QgsAttributeTableDialog::QgsAttributeTableDialog( QgsVectorLayer *theLayer, QWid
7171
mColumnBox = columnBox;
7272
columnBoxInit();
7373

74-
QSettings mySettings;
75-
bool myDockFlag = mySettings.value( "/qgis/dockAttributeTable", false ).toBool();
74+
bool myDockFlag = settings.value( "/qgis/dockAttributeTable", false ).toBool();
7675
if ( myDockFlag )
7776
{
7877
mDock = new QgsAttributeTableDock( tr( "Attribute table - %1 (%n Feature(s))", "feature count", mModel->rowCount() ).arg( mLayer->name() ), QgisApp::instance() );
@@ -122,6 +121,11 @@ QgsAttributeTableDialog::QgsAttributeTableDialog( QgsVectorLayer *theLayer, QWid
122121
connect( mView->verticalHeader(), SIGNAL( sectionPressed( int ) ), this, SLOT( updateRowPressed( int ) ) );
123122
connect( mModel, SIGNAL( modelChanged() ), this, SLOT( updateSelection() ) );
124123

124+
if ( settings.value( "/qgis/attributeTableBehaviour", 0 ).toInt() == 2 )
125+
{
126+
connect( QgisApp::instance()->mapCanvas(), SIGNAL( extentsChanged() ), mModel, SLOT( layerModified() ) );
127+
}
128+
125129
mLastClickedHeaderIndex = 0;
126130
mSelectionModel = new QItemSelectionModel( mFilterModel );
127131
updateSelectionFromLayer();
@@ -221,7 +225,19 @@ void QgsAttributeTableDialog::on_mCopySelectedRowsButton_clicked()
221225

222226
void QgsAttributeTableDialog::on_mZoomMapToSelectedRowsButton_clicked()
223227
{
228+
QSettings settings;
229+
bool canvasFeatures = settings.value( "/qgis/attributeTableBehaviour", 0 ).toInt() == 2;
230+
if ( canvasFeatures )
231+
{
232+
disconnect( QgisApp::instance()->mapCanvas(), SIGNAL( extentsChanged() ), mModel, SLOT( layerModified() ) );
233+
}
234+
224235
QgisApp::instance()->mapCanvas()->zoomToSelected( mLayer );
236+
237+
if ( canvasFeatures )
238+
{
239+
connect( QgisApp::instance()->mapCanvas(), SIGNAL( extentsChanged() ), mModel, SLOT( layerModified() ) );
240+
}
225241
}
226242

227243
void QgsAttributeTableDialog::on_mInvertSelectionButton_clicked()

src/app/attributetable/qgsattributetablemodel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ class QgsAttributeTableModel: public QAbstractTableModel
163163
* Rebuilds the model
164164
* @param onlyGeometry true if only geometry has changed
165165
*/
166-
virtual void layerModified( bool onlyGeometry );
166+
virtual void layerModified( bool onlyGeometry = false );
167167

168168
protected slots:
169169
#if 0

0 commit comments

Comments
 (0)