Skip to content

Commit 1341537

Browse files
committedApr 19, 2017
sipify QgsIdentifyMenu
1 parent e5ab2f6 commit 1341537

File tree

3 files changed

+112
-40
lines changed

3 files changed

+112
-40
lines changed
 

‎python/auto_sip.blacklist

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,6 @@ gui/qgsgroupwmsdatadialog.sip
374374
gui/qgshelp.sip
375375
gui/qgshighlight.sip
376376
gui/qgshistogramwidget.sip
377-
gui/qgsidentifymenu.sip
378377
gui/qgskeyvaluewidget.sip
379378
gui/qgslistwidget.sip
380379
gui/qgslegendfilterbutton.sip

‎python/gui/qgsidentifymenu.sip

Lines changed: 106 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,27 @@
1+
/************************************************************************
2+
* This file has been generated automatically from *
3+
* *
4+
* src/gui/qgsidentifymenu.h *
5+
* *
6+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
7+
************************************************************************/
8+
9+
10+
11+
12+
113
class QgsIdentifyMenu : QMenu
214
{
3-
%TypeHeaderCode
4-
#include <qgsidentifymenu.h>
15+
%Docstring
16+
The QgsIdentifyMenu class builds a menu to be used with identify results (\see QgsMapToolIdentify).
17+
It is customizable and can display attribute actions (\see QgsAction) as well as map layer actions (\see QgsMapLayerAction).
18+
It can also embed custom map layer actions, defined for this menu exclusively.
19+
If used in a QgsMapToolIdentify, it is accessible via QgsMapToolIdentify.identifyMenu() and can be customized in the map tool sub-class.
520
%End
621

22+
%TypeHeaderCode
23+
#include "qgsidentifymenu.h"
24+
%End
725
public:
826
enum MenuLevel
927
{
@@ -15,74 +33,126 @@ class QgsIdentifyMenu : QMenu
1533
{
1634
ActionData();
1735

36+
ActionData( QgsMapLayer *layer, QgsMapLayerAction *mapLayerAction = 0 );
1837

19-
ActionData( QgsMapLayer* layer, QgsMapLayerAction* mapLayerAction = 0 );
20-
21-
ActionData( QgsMapLayer* layer, QgsFeatureId fid, QgsMapLayerAction* mapLayerAction = 0 );
38+
ActionData( QgsMapLayer *layer, QgsFeatureId fid, QgsMapLayerAction *mapLayerAction = 0 );
2239

2340
bool mIsValid;
2441
bool mAllResults;
2542
bool mIsExternalAction;
26-
QgsMapLayer* mLayer;
43+
QgsMapLayer *mLayer;
2744
QgsFeatureId mFeatureId;
2845
QgsIdentifyMenu::MenuLevel mLevel;
29-
QgsMapLayerAction* mMapLayerAction;
46+
QgsMapLayerAction *mMapLayerAction;
3047
};
3148

32-
/**
33-
* @brief QgsIdentifyMenu is a menu to be used to choose within a list of QgsMapTool::IdentifyReults
34-
*/
35-
explicit QgsIdentifyMenu( QgsMapCanvas* canvas );
49+
explicit QgsIdentifyMenu( QgsMapCanvas *canvas );
50+
%Docstring
51+
QgsIdentifyMenu is a menu to be used to choose within a list of QgsMapTool.IdentifyReults
52+
%End
3653

3754
~QgsIdentifyMenu();
3855

39-
//! define if the menu executed can return multiple results (e.g. all results or all identified features of a vector layer)
4056
void setAllowMultipleReturn( bool multipleReturn );
57+
%Docstring
58+
define if the menu executed can return multiple results (e.g. all results or all identified features of a vector layer)
59+
%End
4160
bool allowMultipleReturn();
61+
%Docstring
62+
:rtype: bool
63+
%End
4264

43-
//! define if the menu will be shown with a single idetify result
4465
void setExecWithSingleResult( bool execWithSingleResult );
66+
%Docstring
67+
define if the menu will be shown with a single idetify result
68+
%End
4569
bool execWithSingleResult();
70+
%Docstring
71+
:rtype: bool
72+
%End
4673

47-
/**
48-
* @brief define if attribute actions(1) and map layer actions(2) can be listed and run from the menu
49-
* @note custom actions will be shown in any case if they exist.
50-
* @note (1) attribute actions are defined by the user in the layer properties @see QgsActionManager
51-
* @note (2) map layer actions are built-in c++ actions or actions which are defined by a python plugin @see QgsMapLayerActionRegistry
52-
*/
5374
void setShowFeatureActions( bool showFeatureActions );
75+
%Docstring
76+
define if attribute actions(1) and map layer actions(2) can be listed and run from the menu
77+
.. note::
78+
79+
custom actions will be shown in any case if they exist.
80+
.. note::
81+
82+
(1) attribute actions are defined by the user in the layer properties \see QgsAction
83+
.. note::
84+
85+
(2) map layer actions are built-in c++ actions or actions which are defined by a Python plugin \see QgsMapLayerActionRegistry
86+
%End
5487
bool showFeatureActions();
88+
%Docstring
89+
:rtype: bool
90+
%End
5591

56-
/**
57-
* @brief setResultsIfExternalAction if set to false (default) the menu will not return any results if an external action has been triggered
58-
* @note external action can be either custom actions or feature / map layer actions (@see setShowFeatureActions)
59-
*/
6092
void setResultsIfExternalAction( bool resultsIfExternalAction );
93+
%Docstring
94+
setResultsIfExternalAction if set to false (default) the menu will not return any results if an external action has been triggered
95+
.. note::
96+
97+
external action can be either custom actions or feature / map layer actions (\see setShowFeatureActions)
98+
%End
6199
bool resultsIfExternalAction();
100+
%Docstring
101+
:rtype: bool
102+
%End
62103

63-
//! Defines the maximum number of layers displayed in the menu (default is 10).
64-
//! @note 0 is unlimited.
65104
void setMaxLayerDisplay( int maxLayerDisplay );
105+
%Docstring
106+
.. note::
107+
108+
0 is unlimited.
109+
110+
%End
66111
int maxLayerDisplay();
112+
%Docstring
113+
:rtype: int
114+
%End
67115

68-
//! Defines the maximum number of features displayed in the menu for vector layers (default is 10).
69-
//! @note 0 is unlimited.
70116
void setMaxFeatureDisplay( int maxFeatureDisplay );
117+
%Docstring
118+
.. note::
119+
120+
0 is unlimited.
121+
122+
%End
71123
int maxFeatureDisplay();
124+
%Docstring
125+
:rtype: int
126+
%End
72127

73-
//! adds a new custom action to the menu
74-
void addCustomAction( QgsMapLayerAction* action );
128+
void addCustomAction( QgsMapLayerAction *action );
129+
%Docstring
130+
adds a new custom action to the menu
131+
%End
75132

76-
//! remove all custom actions from the menu to be built
77133
void removeCustomActions();
134+
%Docstring
135+
remove all custom actions from the menu to be built
136+
%End
78137

79-
/**
80-
* @brief exec
81-
* @param idResults the list of identify results to choose within
82-
* @param pos the position where the menu will be executed
83-
*/
84-
QList<QgsMapToolIdentify::IdentifyResult> exec( const QList<QgsMapToolIdentify::IdentifyResult>& idResults, QPoint pos );
138+
QList<QgsMapToolIdentify::IdentifyResult> exec( const QList<QgsMapToolIdentify::IdentifyResult> &idResults, QPoint pos );
139+
%Docstring
140+
exec
141+
\param idResults the list of identify results to choose within
142+
\param pos the position where the menu will be executed
143+
:rtype: list of QgsMapToolIdentify.IdentifyResult
144+
%End
85145

86146
protected:
87147
virtual void closeEvent( QCloseEvent *e );
148+
88149
};
150+
151+
152+
/************************************************************************
153+
* This file has been generated automatically from *
154+
* *
155+
* src/gui/qgsidentifymenu.h *
156+
* *
157+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
158+
************************************************************************/

‎src/gui/qgsidentifymenu.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@
2121
#include "qgsmaplayeractionregistry.h"
2222
#include "qgsmaptoolidentify.h"
2323
#include "qgis_gui.h"
24+
#include "qgis.h"
2425

25-
/// @cond PRIVATE
26+
#ifndef SIP_RUN
27+
/// \cond PRIVATE
2628
class CustomActionRegistry : public QgsMapLayerActionRegistry
2729
{
2830
Q_OBJECT
@@ -32,7 +34,8 @@ class CustomActionRegistry : public QgsMapLayerActionRegistry
3234
// remove all actions
3335
void clear() { mMapLayerActionList.clear(); }
3436
};
35-
///@endcond
37+
///\endcond
38+
#endif
3639

3740
/** \ingroup gui
3841
* \brief The QgsIdentifyMenu class builds a menu to be used with identify results (\see QgsMapToolIdentify).
@@ -89,7 +92,7 @@ class GUI_EXPORT QgsIdentifyMenu : public QMenu
8992
bool mIsExternalAction;
9093
QgsMapLayer *mLayer = nullptr;
9194
QgsFeatureId mFeatureId;
92-
MenuLevel mLevel;
95+
QgsIdentifyMenu::MenuLevel mLevel;
9396
QgsMapLayerAction *mMapLayerAction = nullptr;
9497
};
9598

0 commit comments

Comments
 (0)
Please sign in to comment.