mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-28 00:17:30 -05:00
make flashing independent from panning/zooming in attribte table in attribute editor mode (#29955)
This commit is contained in:
parent
5ef63dfb45
commit
09126ded98
@ -38,7 +38,6 @@ and the attributes for the currently selected feature are shown in a form.
|
|||||||
enum FeatureListBrowsingAction
|
enum FeatureListBrowsingAction
|
||||||
{
|
{
|
||||||
NoAction,
|
NoAction,
|
||||||
FlashFeature,
|
|
||||||
PanToFeature,
|
PanToFeature,
|
||||||
ZoomToFeature,
|
ZoomToFeature,
|
||||||
};
|
};
|
||||||
|
@ -83,14 +83,15 @@ QgsDualView::QgsDualView( QWidget *parent )
|
|||||||
|
|
||||||
QButtonGroup *buttonGroup = new QButtonGroup( this );
|
QButtonGroup *buttonGroup = new QButtonGroup( this );
|
||||||
buttonGroup->setExclusive( false );
|
buttonGroup->setExclusive( false );
|
||||||
buttonGroup->addButton( mFlashButton, FlashFeature );
|
|
||||||
buttonGroup->addButton( mAutoPanButton, PanToFeature );
|
buttonGroup->addButton( mAutoPanButton, PanToFeature );
|
||||||
buttonGroup->addButton( mAutoZoomButton, ZoomToFeature );
|
buttonGroup->addButton( mAutoZoomButton, ZoomToFeature );
|
||||||
FeatureListBrowsingAction action = QgsSettings().enumValue( QStringLiteral( "/qgis/attributeTable/featureListBrowsingAction" ), FlashFeature );
|
FeatureListBrowsingAction action = QgsSettings().enumValue( QStringLiteral( "/qgis/attributeTable/featureListBrowsingAction" ), NoAction );
|
||||||
QAbstractButton *bt = buttonGroup->button( static_cast<int>( action ) );
|
QAbstractButton *bt = buttonGroup->button( static_cast<int>( action ) );
|
||||||
if ( bt )
|
if ( bt )
|
||||||
bt->setChecked( true );
|
bt->setChecked( true );
|
||||||
connect( buttonGroup, qgis::overload< QAbstractButton *, bool >::of( &QButtonGroup::buttonToggled ), this, &QgsDualView::panZoomGroupButtonToggled );
|
connect( buttonGroup, qgis::overload< QAbstractButton *, bool >::of( &QButtonGroup::buttonToggled ), this, &QgsDualView::panZoomGroupButtonToggled );
|
||||||
|
mFlashButton->setChecked( QgsSettings().value( QStringLiteral( "/qgis/attributeTable/featureListHighlightFeature" ), true ).toBool() );
|
||||||
|
connect( mFlashButton, &QToolButton::clicked, this, &QgsDualView::flashButtonClicked );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsDualView::init( QgsVectorLayer *layer, QgsMapCanvas *mapCanvas, const QgsFeatureRequest &request,
|
void QgsDualView::init( QgsVectorLayer *layer, QgsMapCanvas *mapCanvas, const QgsFeatureRequest &request,
|
||||||
@ -452,15 +453,14 @@ void QgsDualView::panOrZoomToFeature( const QgsFeatureIds &featureset )
|
|||||||
QTimer::singleShot( 0, this, [ = ]()
|
QTimer::singleShot( 0, this, [ = ]()
|
||||||
{
|
{
|
||||||
canvas->panToFeatureIds( mLayer, featureset, false );
|
canvas->panToFeatureIds( mLayer, featureset, false );
|
||||||
canvas->flashFeatureIds( mLayer, featureset );
|
|
||||||
} );
|
} );
|
||||||
else if ( mAutoZoomButton->isChecked() )
|
else if ( mAutoZoomButton->isChecked() )
|
||||||
QTimer::singleShot( 0, this, [ = ]()
|
QTimer::singleShot( 0, this, [ = ]()
|
||||||
{
|
{
|
||||||
canvas->zoomToFeatureIds( mLayer, featureset );
|
canvas->zoomToFeatureIds( mLayer, featureset );
|
||||||
canvas->flashFeatureIds( mLayer, featureset );
|
|
||||||
} );
|
} );
|
||||||
else if ( mFlashButton->isChecked() )
|
|
||||||
|
if ( mFlashButton->isChecked() )
|
||||||
QTimer::singleShot( 0, this, [ = ]()
|
QTimer::singleShot( 0, this, [ = ]()
|
||||||
{
|
{
|
||||||
canvas->flashFeatureIds( mLayer, featureset );
|
canvas->flashFeatureIds( mLayer, featureset );
|
||||||
@ -474,19 +474,11 @@ void QgsDualView::panZoomGroupButtonToggled( QAbstractButton *button, bool check
|
|||||||
{
|
{
|
||||||
QgsSettings().setEnumValue( QStringLiteral( "/qgis/attributeTable/featureListBrowsingAction" ), PanToFeature );
|
QgsSettings().setEnumValue( QStringLiteral( "/qgis/attributeTable/featureListBrowsingAction" ), PanToFeature );
|
||||||
mAutoZoomButton->setChecked( false );
|
mAutoZoomButton->setChecked( false );
|
||||||
mFlashButton->setChecked( false );
|
|
||||||
}
|
}
|
||||||
else if ( button == mAutoZoomButton && checked )
|
else if ( button == mAutoZoomButton && checked )
|
||||||
{
|
{
|
||||||
QgsSettings().setEnumValue( QStringLiteral( "/qgis/attributeTable/featureListBrowsingAction" ), ZoomToFeature );
|
QgsSettings().setEnumValue( QStringLiteral( "/qgis/attributeTable/featureListBrowsingAction" ), ZoomToFeature );
|
||||||
mAutoPanButton->setChecked( false );
|
mAutoPanButton->setChecked( false );
|
||||||
mFlashButton->setChecked( false );
|
|
||||||
}
|
|
||||||
else if ( button == mFlashButton && checked )
|
|
||||||
{
|
|
||||||
QgsSettings().setEnumValue( QStringLiteral( "/qgis/attributeTable/featureListBrowsingAction" ), FlashFeature );
|
|
||||||
mAutoZoomButton->setChecked( false );
|
|
||||||
mAutoPanButton->setChecked( false );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -497,6 +489,18 @@ void QgsDualView::panZoomGroupButtonToggled( QAbstractButton *button, bool check
|
|||||||
panOrZoomToFeature( mFeatureListView->currentEditSelection() );
|
panOrZoomToFeature( mFeatureListView->currentEditSelection() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QgsDualView::flashButtonClicked( bool clicked )
|
||||||
|
{
|
||||||
|
QgsSettings().setValue( QStringLiteral( "/qgis/attributeTable/featureListHighlightFeature" ), clicked );
|
||||||
|
if ( !clicked )
|
||||||
|
return;
|
||||||
|
|
||||||
|
QgsMapCanvas *canvas = mFilterModel->mapCanvas();
|
||||||
|
|
||||||
|
if ( canvas )
|
||||||
|
canvas->flashFeatureIds( mLayer, mFeatureListView->currentEditSelection() );
|
||||||
|
}
|
||||||
|
|
||||||
void QgsDualView::featureListAboutToChangeEditSelection( bool &ok )
|
void QgsDualView::featureListAboutToChangeEditSelection( bool &ok )
|
||||||
{
|
{
|
||||||
if ( mLayer->isEditable() && !mAttributeForm->save() )
|
if ( mLayer->isEditable() && !mAttributeForm->save() )
|
||||||
@ -517,6 +521,7 @@ void QgsDualView::featureListCurrentEditSelectionChanged( const QgsFeature &feat
|
|||||||
setCurrentEditSelection( featureset );
|
setCurrentEditSelection( featureset );
|
||||||
|
|
||||||
panOrZoomToFeature( featureset );
|
panOrZoomToFeature( featureset );
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -72,7 +72,6 @@ class GUI_EXPORT QgsDualView : public QStackedWidget, private Ui::QgsDualViewBas
|
|||||||
enum FeatureListBrowsingAction
|
enum FeatureListBrowsingAction
|
||||||
{
|
{
|
||||||
NoAction = 0, //!< No action is done
|
NoAction = 0, //!< No action is done
|
||||||
FlashFeature, //!< The feature is highlighted with a flash
|
|
||||||
PanToFeature, //!< The map is panned to the center of the feature bounding-box
|
PanToFeature, //!< The map is panned to the center of the feature bounding-box
|
||||||
ZoomToFeature, //!< The map is zoomed to contained the feature bounding-box
|
ZoomToFeature, //!< The map is zoomed to contained the feature bounding-box
|
||||||
};
|
};
|
||||||
@ -372,6 +371,8 @@ class GUI_EXPORT QgsDualView : public QStackedWidget, private Ui::QgsDualViewBas
|
|||||||
|
|
||||||
void panZoomGroupButtonToggled( QAbstractButton *button, bool checked );
|
void panZoomGroupButtonToggled( QAbstractButton *button, bool checked );
|
||||||
|
|
||||||
|
void flashButtonClicked( bool clicked );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -132,6 +132,9 @@
|
|||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
@ -144,9 +147,6 @@
|
|||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="spacing">
|
|
||||||
<number>1</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QToolButton" name="mFirstFeatureButton">
|
<widget class="QToolButton" name="mFirstFeatureButton">
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
@ -278,6 +278,19 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QToolButton" name="mAutoPanButton">
|
<widget class="QToolButton" name="mAutoPanButton">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user