1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 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
|
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsdataitemguiprovider.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
class QgsDataItemGuiContext
{
%Docstring(signature="appended")
Encapsulates the context in which a :py:class:`QgsDataItem` is shown
within the application GUI.
.. versionadded:: 3.6
%End
%TypeHeaderCode
#include "qgsdataitemguiprovider.h"
%End
public:
QgsDataItemGuiContext();
QgsMessageBar *messageBar() const;
%Docstring
Returns the associated message bar.
This bar can be used to provide non-blocking feedback to users.
.. seealso:: :py:func:`setMessageBar`
%End
void setMessageBar( QgsMessageBar *bar );
%Docstring
Sets the associated message ``bar``.
This bar can be used to provide non-blocking feedback to users.
.. seealso:: :py:func:`messageBar`
%End
QgsBrowserTreeView *view() const;
%Docstring
Returns the associated view.
.. seealso:: :py:func:`setView`
.. versionadded:: 3.28
%End
void setView( QgsBrowserTreeView *view );
%Docstring
Sets the associated ``view``.
.. seealso:: :py:func:`view`
.. versionadded:: 3.28
%End
};
class QgsDataItemGuiProvider
{
%Docstring(signature="appended")
Abstract base class for providers which affect how
:py:class:`QgsDataItem` items behave within the application GUI.
Providers must be registered via
:py:class:`QgsDataItemGuiProviderRegistry`.
.. versionadded:: 3.6
%End
%TypeHeaderCode
#include "qgsdataitemguiprovider.h"
%End
public:
virtual ~QgsDataItemGuiProvider();
virtual QString name() = 0;
%Docstring
Returns the provider's name.
%End
virtual void populateContextMenu( QgsDataItem *item, QMenu *menu, const QList<QgsDataItem *> &selectedItems, QgsDataItemGuiContext context );
%Docstring
Called when the given context ``menu`` is being populated for the given
``item``, allowing the provider to add its own actions and submenus to
the context menu. Additionally, providers could potentially alter menus
and actions added by other providers if desired, or use standard QMenu
API to insert their items and submenus into the desired location within
the context menu.
The ``selectedItems`` list contains a list of ALL currently selected
items within the browser view. Subclasses can utilize this list in order
to create actions which operate on multiple items at once, e.g. to allow
deletion of multiple layers from a database at once.
When creating a context menu, this method is called for EVERY
QgsDataItemGuiProvider within the
:py:class:`QgsDataItemGuiProviderRegistry`. It is the
QgsDataItemGuiProvider subclass' responsibility to test the ``item`` and
``selectedItems`` for their properties and classes and decide what
actions (if any) are appropriate to add to the context ``menu``.
Care must be taken to correctly parent newly created sub menus and
actions to the provided ``menu`` to avoid memory leaks.
The ``context`` argument gives the wider context under which the context
menu is being shown, and contains accessors for useful objects like the
application message bar.
The base class method has no effect.
%End
virtual int precedenceWhenPopulatingMenus() const;
%Docstring
Returns the provider's precedence to use when populating context menus
via calls to :py:func:`~QgsDataItemGuiProvider.populateContextMenu`.
Providers which return larger values will be called AFTER other
providers when the menu is being populated. This allows them to nicely
insert their corresponding menu items in the desired location with
respect to existing items added by other providers.
The default implementation returns 0.
.. versionadded:: 3.22
%End
virtual bool rename( QgsDataItem *item, const QString &name, QgsDataItemGuiContext context );
%Docstring
Sets a new ``name`` for the item, and returns ``True`` if the item was
successfully renamed.
Items which implement this method should return the
:py:class:`QgsDataItem`.Rename capability.
The default implementation does nothing.
.. versionadded:: 3.10
%End
virtual bool deleteLayer( QgsLayerItem *item, QgsDataItemGuiContext context );
%Docstring
Tries to permanently delete map layer representing the given item.
Returns ``True`` if the layer was successfully deleted.
Items which implement this method should return the
:py:class:`QgsDataItem`.Delete capability.
The default implementation does nothing.
.. versionadded:: 3.10
%End
virtual bool handleDoubleClick( QgsDataItem *item, QgsDataItemGuiContext context );
%Docstring
Called when a user double clicks on an ``item``. Providers should return
``True`` if the double-click was handled and do not want other providers
to handle the double-click, and to prevent the default double-click
behavior for items.
%End
virtual bool acceptDrop( QgsDataItem *item, QgsDataItemGuiContext context );
%Docstring
Providers should return ``True`` if the drops are allowed
(:py:func:`~QgsDataItemGuiProvider.handleDrop` should be implemented in
that case as well).
.. versionadded:: 3.10
%End
virtual bool handleDrop( QgsDataItem *item, QgsDataItemGuiContext context, const QMimeData *data, Qt::DropAction action );
%Docstring
Called when a user drops on an ``item``. Providers should return
``True`` if the drop was handled and do not want other providers to
handle the drop, and to prevent the default drop behavior for items.
.. versionadded:: 3.10
%End
virtual QWidget *createParamWidget( QgsDataItem *item, QgsDataItemGuiContext context ) /Factory/;
%Docstring
Creates source widget from data item for
:py:class:`QgsBrowserPropertiesWidget` By default it returns None.
Caller takes responsibility of deleting created.
The function is replacement of :py:func:`QgsDataItem.paramWidget()`
.. versionadded:: 3.10
%End
static void notify( const QString &title, const QString &message, QgsDataItemGuiContext context, Qgis::MessageLevel level = Qgis::MessageLevel::Info, int duration = -1, QWidget *parent = 0 );
%Docstring
Notify the user showing a ``message`` with ``title`` and ``level`` If
the context has a message bar the message will be shown in the message
bar else a message dialog will be used.
Since QGIS 3.18, the optional ``duration`` argument can be used to
specify the message timeout in seconds. If ``duration`` is set to 0,
then the message must be manually dismissed by the user. A duration of
-1 indicates that the default timeout for the message ``level`` should
be used.
.. versionadded:: 3.16
%End
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsdataitemguiprovider.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
|