Skip to content

Commit

Permalink
let attribute table follow canvas extent
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13551 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed May 22, 2010
1 parent c3af209 commit 738b4ca
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
20 changes: 18 additions & 2 deletions src/app/attributetable/qgsattributetabledialog.cpp
Expand Up @@ -71,8 +71,7 @@ QgsAttributeTableDialog::QgsAttributeTableDialog( QgsVectorLayer *theLayer, QWid
mColumnBox = columnBox;
columnBoxInit();

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

if ( settings.value( "/qgis/attributeTableBehaviour", 0 ).toInt() == 2 )
{
connect( QgisApp::instance()->mapCanvas(), SIGNAL( extentsChanged() ), mModel, SLOT( layerModified() ) );
}

mLastClickedHeaderIndex = 0;
mSelectionModel = new QItemSelectionModel( mFilterModel );
updateSelectionFromLayer();
Expand Down Expand Up @@ -221,7 +225,19 @@ void QgsAttributeTableDialog::on_mCopySelectedRowsButton_clicked()

void QgsAttributeTableDialog::on_mZoomMapToSelectedRowsButton_clicked()
{
QSettings settings;
bool canvasFeatures = settings.value( "/qgis/attributeTableBehaviour", 0 ).toInt() == 2;
if ( canvasFeatures )
{
disconnect( QgisApp::instance()->mapCanvas(), SIGNAL( extentsChanged() ), mModel, SLOT( layerModified() ) );
}

QgisApp::instance()->mapCanvas()->zoomToSelected( mLayer );

if ( canvasFeatures )
{
connect( QgisApp::instance()->mapCanvas(), SIGNAL( extentsChanged() ), mModel, SLOT( layerModified() ) );
}
}

void QgsAttributeTableDialog::on_mInvertSelectionButton_clicked()
Expand Down
2 changes: 1 addition & 1 deletion src/app/attributetable/qgsattributetablemodel.h
Expand Up @@ -163,7 +163,7 @@ class QgsAttributeTableModel: public QAbstractTableModel
* Rebuilds the model
* @param onlyGeometry true if only geometry has changed
*/
virtual void layerModified( bool onlyGeometry );
virtual void layerModified( bool onlyGeometry = false );

protected slots:
#if 0
Expand Down

0 comments on commit 738b4ca

Please sign in to comment.