Main
QGIS CPLUS Plugin Implementation.
Source code in src/cplus_plugin/main.py
add_action
add_action(icon_path, text, callback, enabled_flag=True, add_to_menu=True, add_to_web_menu=True, add_to_toolbar=True, set_as_default_action=False, status_tip=None, whats_this=None, parent=None)
Add a toolbar icon to the toolbar.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
icon_path |
str
|
Path to the icon for this action |
required |
text |
str
|
Text that should be shown in menu items for this action |
required |
callback |
function
|
Function to be called when the action is triggered |
required |
enabled_flag |
bool
|
A flag indicating if the action should be enabled |
True
|
add_to_menu |
bool
|
Flag indicating whether the action should also be added to the menu |
True
|
add_to_web_menu |
bool
|
Flag indicating whether the action should also be added to the web menu |
True
|
add_to_toolbar |
bool
|
Flag indicating whether the action should also be added to the toolbar |
True
|
set_as_default_action |
bool
|
Flag indicating whether the action is the default action |
False
|
status_tip |
str
|
Optional text to show in a popup when mouse pointer hovers over the action |
None
|
parent |
QWidget
|
Parent widget for the new action |
None
|
whats_this |
str
|
Optional text to show in the status bar when the mouse pointer hovers over the action |
None
|
Returns:
Type | Description |
---|---|
QAction
|
The action that was created |
Source code in src/cplus_plugin/main.py
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 |
|
create_dock_widget_action
Create the action corresponding to the main dock widget.
Source code in src/cplus_plugin/main.py
initGui
Create the menu entries and toolbar icons inside the QGIS GUI.
Source code in src/cplus_plugin/main.py
install_report_font
Checks if the report font exists and install it.
Source code in src/cplus_plugin/main.py
onClosePlugin
on_dock_widget_visibility_changed
Slot raised when the visibility of the main docket widget changes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
visible |
bool
|
True if the dock widget is visible, else False. |
required |
Source code in src/cplus_plugin/main.py
on_layout_designer_opened
Register custom report variables in a print layout only.
Source code in src/cplus_plugin/main.py
open_about
open_help
register_layout_items
Register custom layout items.
Source code in src/cplus_plugin/main.py
run
Creates the main widget for the plugin.
Source code in src/cplus_plugin/main.py
run_settings
tr
Get the translation for a string using Qt translation API. We implement this ourselves since we do not inherit QObject.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
message |
str
|
String for translation |
required |
Returns:
Type | Description |
---|---|
QString
|
Translated version of the message |
Source code in src/cplus_plugin/main.py
unload
Removes the plugin menu item and icon from QGIS GUI.