Skip to content
Permalink
Browse files
let attribute table follow canvas extent
git-svn-id: http://svn.osgeo.org/qgis/trunk@13551 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed May 22, 2010
1 parent 0336b6d commit 57b82b98413bb82452fb9bfff57296f6fd53f988
@@ -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() );
@@ -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();
@@ -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()
@@ -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

0 comments on commit 57b82b9

Please sign in to comment.