2017-04-19 15:51:02 +02:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsidentifymenu.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
2014-09-17 11:23:22 +02:00
class QgsIdentifyMenu : QMenu
{
2021-03-22 21:13:52 +01:00
%Docstring(signature="appended")
2018-05-26 14:10:30 +10:00
The QgsIdentifyMenu class builds a menu to be used with identify results (:py:class:`QgsMapToolIdentify`).
2018-01-09 17:26:37 -04:00
It is customizable and can display attribute actions (:py:class:`QgsAction`) as well as map layer actions (\see QgsMapLayerAction).
2017-12-15 10:36:55 -04:00
It can also embed custom map layer actions, defined for this menu exclusively.
2021-01-30 09:16:35 +10:00
If used in a :py:class:`QgsMapToolIdentify`, it is accessible via :py:func:`QgsMapToolIdentify.identifyMenu()` and can be customized in the map tool sub-class.
2014-09-17 11:23:22 +02:00
%End
2017-04-19 15:51:02 +02:00
%TypeHeaderCode
#include "qgsidentifymenu.h"
%End
2014-09-17 11:23:22 +02:00
public:
enum MenuLevel
{
LayerLevel,
FeatureLevel
};
struct ActionData
{
ActionData();
2017-11-11 15:22:19 +10:00
%Docstring
Constructor for ActionData
%End
2017-04-26 08:22:27 +02:00
2017-04-19 15:51:02 +02:00
ActionData( QgsMapLayer *layer, QgsMapLayerAction *mapLayerAction = 0 );
2017-04-26 08:22:27 +02:00
2017-04-19 15:51:02 +02:00
ActionData( QgsMapLayer *layer, QgsFeatureId fid, QgsMapLayerAction *mapLayerAction = 0 );
2017-04-26 08:22:27 +02:00
2014-09-17 11:23:22 +02:00
bool mIsValid;
bool mAllResults;
bool mIsExternalAction;
2017-04-19 15:51:02 +02:00
QgsMapLayer *mLayer;
2014-09-17 11:23:22 +02:00
QgsFeatureId mFeatureId;
2014-09-17 16:15:39 +02:00
QgsIdentifyMenu::MenuLevel mLevel;
2017-04-19 15:51:02 +02:00
QgsMapLayerAction *mMapLayerAction;
2014-09-17 11:23:22 +02:00
};
2017-04-19 15:51:02 +02:00
explicit QgsIdentifyMenu( QgsMapCanvas *canvas );
%Docstring
2018-05-26 14:10:30 +10:00
QgsIdentifyMenu is a menu to be used to choose within a list of QgsMapTool.IdentifyReults
2017-04-19 15:51:02 +02:00
%End
2014-09-17 11:23:22 +02:00
~QgsIdentifyMenu();
2022-04-12 11:07:34 +10:00
2023-02-21 13:51:08 +10:00
static QList<QgsMapToolIdentify::IdentifyResult> findFeaturesOnCanvas( QgsMapMouseEvent *event, QgsMapCanvas *canvas, const QList<Qgis::GeometryType> &geometryTypes );
2022-04-12 11:07:34 +10:00
%Docstring
Searches for features on the map ``canvas``, which are located at the specified ``event`` point.
The ``geometryTypes`` argument lists acceptable geometry types.
This method searches through all layers on the canvas, attempting to find matching features at the event
point.
.. versionadded:: 3.26
%End
2014-09-17 11:23:22 +02:00
void setAllowMultipleReturn( bool multipleReturn );
2017-04-19 15:51:02 +02:00
%Docstring
define if the menu executed can return multiple results (e.g. all results or all identified features of a vector layer)
%End
2014-09-17 11:23:22 +02:00
bool allowMultipleReturn();
void setExecWithSingleResult( bool execWithSingleResult );
2017-04-19 15:51:02 +02:00
%Docstring
2018-09-14 09:33:30 +02:00
define if the menu will be shown with a single identify result
2017-04-19 15:51:02 +02:00
%End
2014-09-17 11:23:22 +02:00
bool execWithSingleResult();
2017-11-10 15:01:08 +00:00
void setExpressionContextScope( const QgsExpressionContextScope &scope );
%Docstring
2017-12-15 10:36:55 -04:00
Sets an expression context scope used to resolve underlying actions.
2017-11-10 15:01:08 +00:00
.. versionadded:: 3.0
%End
QgsExpressionContextScope expressionContextScope() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns an expression context scope used to resolve underlying actions.
2017-11-10 15:01:08 +00:00
.. versionadded:: 3.0
%End
2014-09-17 11:23:22 +02:00
void setShowFeatureActions( bool showFeatureActions );
2017-04-19 15:51:02 +02:00
%Docstring
2018-05-26 14:10:30 +10:00
define if attribute actions(1) and map layer actions(2) can be listed and run from the menu
2017-12-15 10:36:55 -04:00
2017-04-19 15:51:02 +02:00
.. note::
custom actions will be shown in any case if they exist.
2017-12-15 10:36:55 -04:00
2018-01-09 17:26:37 -04:00
.. note::
(1) attribute actions are defined by the user in the layer properties :py:class:`QgsAction`
2017-12-15 10:36:55 -04:00
2018-01-09 17:26:37 -04:00
.. note::
(2) map layer actions are built-in c++ actions or actions which are defined by a Python plugin :py:class:`QgsMapLayerActionRegistry`
2017-04-19 15:51:02 +02:00
%End
2014-09-17 11:23:22 +02:00
bool showFeatureActions();
void setResultsIfExternalAction( bool resultsIfExternalAction );
2017-04-19 15:51:02 +02:00
%Docstring
2019-02-26 19:54:09 +10:00
setResultsIfExternalAction if set to ``False`` (default) the menu will not return any results if an external action has been triggered
2017-12-15 10:36:55 -04:00
2018-01-09 17:26:37 -04:00
.. note::
external action can be either custom actions or feature / map layer actions (:py:func:`setShowFeatureActions`)
2017-04-19 15:51:02 +02:00
%End
2014-09-17 11:23:22 +02:00
bool resultsIfExternalAction();
void setMaxLayerDisplay( int maxLayerDisplay );
2017-04-19 15:51:02 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Defines the maximum number of layers displayed in the menu (default is 10).
2017-04-19 15:51:02 +02:00
.. note::
0 is unlimited.
%End
2014-09-17 11:23:22 +02:00
int maxLayerDisplay();
void setMaxFeatureDisplay( int maxFeatureDisplay );
2017-04-19 15:51:02 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Defines the maximum number of features displayed in the menu for vector layers (default is 10).
2017-04-19 15:51:02 +02:00
.. note::
0 is unlimited.
%End
2014-09-17 11:23:22 +02:00
int maxFeatureDisplay();
2017-04-19 15:51:02 +02:00
void addCustomAction( QgsMapLayerAction *action );
%Docstring
adds a new custom action to the menu
%End
2014-09-17 11:23:22 +02:00
void removeCustomActions();
2017-04-19 15:51:02 +02:00
%Docstring
remove all custom actions from the menu to be built
%End
2014-09-17 11:23:22 +02:00
2017-04-19 15:51:02 +02:00
QList<QgsMapToolIdentify::IdentifyResult> exec( const QList<QgsMapToolIdentify::IdentifyResult> &idResults, QPoint pos );
%Docstring
2018-05-26 14:10:30 +10:00
exec
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param idResults: the list of identify results to choose within
:param pos: the position where the menu will be executed
2019-05-23 07:56:49 -05:00
%End
2022-11-19 09:15:20 +10:00
static void styleHighlight( QgsHighlight *highlight ) /Deprecated/;
2019-05-23 07:56:49 -05:00
%Docstring
Applies style from the settings to the highlight
2022-11-19 09:15:20 +10:00
.. deprecated::
Use :py:func:`QgsHighlight.applyDefaultStyle()` instead.
2017-04-19 15:51:02 +02:00
%End
2014-10-23 14:44:48 +02:00
2021-10-19 23:30:56 +02:00
protected:
2014-10-23 14:44:48 +02:00
virtual void closeEvent( QCloseEvent *e );
2017-04-19 15:51:02 +02:00
2017-12-15 08:57:22 +10:00
2014-09-17 11:23:22 +02:00
};
2017-04-19 15:51:02 +02:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsidentifymenu.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/