mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-01 00:46:20 -05:00
Merge pull request #4937 from m-kuhn/attributeTableCodeEnhancements$
Attribute table code enhancements
This commit is contained in:
commit
7f1bb72872
@ -474,7 +474,11 @@ void QgsDualView::viewWillShowContextMenu( QMenu *menu, const QModelIndex &atInd
|
||||
continue;
|
||||
|
||||
QgsAttributeTableAction *a = new QgsAttributeTableAction( action.name(), this, action.id(), sourceIndex );
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 6, 0)
|
||||
menu->addAction( action.name(), a, SLOT( execute() ) );
|
||||
#else
|
||||
menu->addAction( action.name(), a, &QgsAttributeTableAction::execute );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -485,17 +489,24 @@ void QgsDualView::viewWillShowContextMenu( QMenu *menu, const QModelIndex &atInd
|
||||
//add a separator between user defined and standard actions
|
||||
menu->addSeparator();
|
||||
|
||||
QList<QgsMapLayerAction *>::iterator actionIt;
|
||||
for ( actionIt = registeredActions.begin(); actionIt != registeredActions.end(); ++actionIt )
|
||||
Q_FOREACH ( QgsMapLayerAction *action, registeredActions )
|
||||
{
|
||||
QgsAttributeTableMapLayerAction *a = new QgsAttributeTableMapLayerAction( ( *actionIt )->text(), this, ( *actionIt ), sourceIndex );
|
||||
menu->addAction( ( *actionIt )->text(), a, SLOT( execute() ) );
|
||||
QgsAttributeTableMapLayerAction *a = new QgsAttributeTableMapLayerAction( action->text(), this, action, sourceIndex );
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 6, 0)
|
||||
menu->addAction( action->text(), a, SLOT( execut() ) );
|
||||
#else
|
||||
menu->addAction( action->text(), a, &QgsAttributeTableMapLayerAction::execute );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
menu->addSeparator();
|
||||
QgsAttributeTableAction *a = new QgsAttributeTableAction( tr( "Open form" ), this, QString(), sourceIndex );
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 6, 0)
|
||||
menu->addAction( tr( "Open form" ), a, SLOT( featureForm() ) );
|
||||
#else
|
||||
menu->addAction( tr( "Open form" ), a, &QgsAttributeTableAction::featureForm );
|
||||
#endif
|
||||
}
|
||||
|
||||
void QgsDualView::showViewHeaderMenu( QPoint point )
|
||||
|
@ -108,12 +108,12 @@ void QgsMapLayerActionRegistry::addMapLayerAction( QgsMapLayerAction *action )
|
||||
QList< QgsMapLayerAction * > QgsMapLayerActionRegistry::mapLayerActions( QgsMapLayer *layer, QgsMapLayerAction::Targets targets )
|
||||
{
|
||||
QList< QgsMapLayerAction * > validActions;
|
||||
QList<QgsMapLayerAction *>::iterator actionIt;
|
||||
for ( actionIt = mMapLayerActionList.begin(); actionIt != mMapLayerActionList.end(); ++actionIt )
|
||||
|
||||
Q_FOREACH ( QgsMapLayerAction *action, mMapLayerActionList )
|
||||
{
|
||||
if ( ( *actionIt )->canRunUsingLayer( layer ) && ( targets & ( *actionIt )->targets() ) )
|
||||
if ( action->canRunUsingLayer( layer ) && ( targets & action->targets() ) )
|
||||
{
|
||||
validActions.append( ( *actionIt ) );
|
||||
validActions.append( action );
|
||||
}
|
||||
}
|
||||
return validActions;
|
||||
|
Loading…
x
Reference in New Issue
Block a user