Skip to content

Commit

Permalink
[attribute table] Fix several issues with form view's feature navigation
Browse files Browse the repository at this point in the history
- Disable zoom / pan when filtering by visible features (fixes #30763)
- Disable flash / zoom / pan when not set to form view
- Do not trigger flash / zoom / pan when selection hasn't actually changed
  • Loading branch information
nirvn committed Jul 19, 2019
1 parent b1e5eb0 commit cb6ef05
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
25 changes: 14 additions & 11 deletions src/gui/attributetable/qgsdualview.cpp
Expand Up @@ -447,24 +447,27 @@ void QgsDualView::updateEditSelectionProgress( int progress, int count )
void QgsDualView::panOrZoomToFeature( const QgsFeatureIds &featureset )
{
QgsMapCanvas *canvas = mFilterModel->mapCanvas();
if ( canvas )
if ( canvas && view() == AttributeEditor && featureset != mLastFeatureSet )
{
if ( mAutoPanButton->isChecked() )
QTimer::singleShot( 0, this, [ = ]()
{
canvas->panToFeatureIds( mLayer, featureset, false );
} );
else if ( mAutoZoomButton->isChecked() )
QTimer::singleShot( 0, this, [ = ]()
if ( filterMode() != QgsAttributeTableFilterModel::ShowVisible )
{
canvas->zoomToFeatureIds( mLayer, featureset );
} );

if ( mAutoPanButton->isChecked() )
QTimer::singleShot( 0, this, [ = ]()
{
canvas->panToFeatureIds( mLayer, featureset, false );
} );
else if ( mAutoZoomButton->isChecked() )
QTimer::singleShot( 0, this, [ = ]()
{
canvas->zoomToFeatureIds( mLayer, featureset );
} );
}
if ( mFlashButton->isChecked() )
QTimer::singleShot( 0, this, [ = ]()
{
canvas->flashFeatureIds( mLayer, featureset );
} );
mLastFeatureSet = featureset;
}
}

Expand Down
1 change: 1 addition & 0 deletions src/gui/attributetable/qgsdualview.h
Expand Up @@ -406,6 +406,7 @@ class GUI_EXPORT QgsDualView : public QStackedWidget, private Ui::QgsDualViewBas
// If the current feature is set, while the form is still not initialized
// we will temporarily save it in here and set it on init
QgsFeature mTempAttributeFormFeature;
QgsFeatureIds mLastFeatureSet;

friend class TestQgsDualView;
friend class TestQgsAttributeTable;
Expand Down

0 comments on commit cb6ef05

Please sign in to comment.