File: qgscustomdrophandler.sip.in

package info (click to toggle)
qgis 3.40.10%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,183,672 kB
  • sloc: cpp: 1,595,771; python: 372,544; xml: 23,474; sh: 3,761; perl: 3,664; ansic: 2,257; sql: 2,137; yacc: 1,068; lex: 577; javascript: 540; lisp: 411; makefile: 161
file content (191 lines) | stat: -rw-r--r-- 7,449 bytes parent folder | download | duplicates (12)
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
/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/gui/qgscustomdrophandler.h                                       *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 ************************************************************************/




class QgsCustomDropHandler : QObject
{
%Docstring(signature="appended")
Abstract base class that may be implemented to handle new types of data
to be dropped in QGIS.

Implementations have three approaches they can use to handle drops.

- The simplest approach is to implement :py:func:`~handleFileDrop` when
  they need to handle dropped files (i.e. with mime type
  "text/uri-list").
- Reimplement :py:func:`~handleCustomUriDrop` when they want to handle
  dropped custom :py:class:`QgsMimeDataUtils`.Uri entries, for instance
  handling dropping custom entries from the browser tree (with mime type
  "application/x-vnd.qgis.qgis.uri"). In this case the implementation's
  :py:func:`~customUriProviderKey` must match the uri entry's
  providerKey.
- Reimplement :py:func:`~handleMimeData` to directly handle dropped
  QMimeData. Subclasses should take care when overriding this method.
  When a drop event occurs, Qt will lock the source application of the
  drag for the duration of the drop event handling via
  :py:func:`~handleMimeData` (e.g. dragging files from explorer to QGIS
  will lock the explorer window until the drop handling has been
  complete). Accordingly :py:func:`~handleMimeData` implementations must
  return quickly and defer any intensive or slow processing.
%End

%TypeHeaderCode
#include "qgscustomdrophandler.h"
%End
  public:
    virtual QString customUriProviderKey() const;
%Docstring
Type of custom URI recognized by the handler. This must match the URI
entry's providerKey in order for
:py:func:`~QgsCustomDropHandler.handleCustomUriDrop` to be called.

.. seealso:: :py:func:`handleCustomUriDrop`
%End

    virtual void handleCustomUriDrop( const QgsMimeDataUtils::Uri &uri ) const;
%Docstring
Called from QGIS after a drop event with custom URI known by the
handler.

In order for :py:func:`~QgsCustomDropHandler.handleCustomUriDrop` to be
called, subclasses must also implement
:py:func:`~QgsCustomDropHandler.customUriProviderKey` to indicate the
providerKey value which the handler accepts.

.. seealso:: :py:func:`customUriProviderKey`
%End

    virtual bool canHandleMimeData( const QMimeData *data );
%Docstring
Returns ``True`` if the handler is capable of handling the provided mime
``data``. The base class implementation returns ``False`` regardless of
mime data.

This method is called when mime data is dragged over the QGIS window, in
order to determine whether any handlers are capable of handling the data
and to determine whether the drag action should be accepted.

.. versionadded:: 3.10
%End


 virtual void handleMimeData( const QMimeData *data ) /Deprecated/;
%Docstring
Called when the specified mime ``data`` has been dropped onto QGIS.

The base class implementation does nothing.

Subclasses should take care when overriding this method. When a drop
event occurs, Qt will lock the source application of the drag for the
duration of the drop event handling (e.g. dragging files from explorer
to QGIS will lock the explorer window until the drop handling has been
complete).

Accordingly, only implementations must be lightweight and return ASAP.
(For instance by copying the relevant parts of ``data`` and then
handling the data after a short timeout).

.. deprecated:: 3.10

   Use :py:func:`~QgsCustomDropHandler.handleMimeDataV2` instead.
%End

    virtual bool handleMimeDataV2( const QMimeData *data );
%Docstring
Called when the specified mime ``data`` has been dropped onto QGIS.

The base class implementation does nothing.

Subclasses should take care when overriding this method. When a drop
event occurs, Qt will lock the source application of the drag for the
duration of the drop event handling (e.g. dragging files from explorer
to QGIS will lock the explorer window until the drop handling has been
complete).

Accordingly, only implementations must be lightweight and return ASAP.
(For instance by copying the relevant parts of ``data`` and then
handling the data after a short timeout).

If the function returns ``True``, it means the handler has accepted the
drop and it should not be further processed (e.g. by other
:py:class:`QgsCustomDropHandlers`)

.. versionadded:: 3.10
%End

    virtual bool handleFileDrop( const QString &file );
%Docstring
Called when the specified ``file`` has been dropped onto QGIS. If
``True`` is returned, then the handler has accepted this file and it
should not be further processed (e.g. by other
:py:class:`QgsCustomDropHandlers`).

The base class implementation does nothing.

This method is not called directly while drop handling is occurring, so
the limitations described in
:py:func:`~QgsCustomDropHandler.handleMimeData` about returning quickly
do not apply.
%End

    virtual bool canHandleCustomUriCanvasDrop( const QgsMimeDataUtils::Uri &uri, QgsMapCanvas *canvas );
%Docstring
Returns ``True`` if the handler is capable of handling the provided mime
``uri`` when dropped onto a map ``canvas``.

The base class implementation returns ``False`` regardless of mime data.

This method is called when mime data is dragged over a map canvas, in
order to determine whether any handlers are capable of handling the data
and to determine whether the drag action should be accepted.

.. warning::

   Subclasses should be very careful about implementing this. If they
   incorrectly return ``True`` to a ``uri``, it will prevent the default application
   drop handling from occurring and will break the ability to drag and drop layers
   and files onto QGIS.

.. versionadded:: 3.10
%End

    virtual bool handleCustomUriCanvasDrop( const QgsMimeDataUtils::Uri &uri, QgsMapCanvas *canvas ) const;
%Docstring
Called from QGIS after a drop event with custom ``uri`` known by the
handler occurs onto a map ``canvas``.

In order for :py:func:`~QgsCustomDropHandler.handleCustomUriCanvasDrop`
to be called, subclasses must also implement
:py:func:`~QgsCustomDropHandler.customUriProviderKey` to indicate the
providerKey value which the handler accepts.

If the function returns ``True``, it means the handler has accepted the
drop and it should not be further processed (e.g. by other
:py:class:`QgsCustomDropHandlers`).

Subclasses which implement this must also implement corresponding
versions of
:py:func:`~QgsCustomDropHandler.canHandleCustomUriCanvasDrop`.

.. seealso:: :py:func:`customUriProviderKey`

.. seealso:: :py:func:`canHandleCustomUriCanvasDrop`

.. versionadded:: 3.10
%End
};

/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/gui/qgscustomdrophandler.h                                       *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 ************************************************************************/