QGIS/python/gui/auto_generated/qgscustomdrophandler.sip.in

113 lines
4.4 KiB
Plaintext
Raw Normal View History

2017-05-23 14:39:33 +02:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgscustomdrophandler.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsCustomDropHandler : QObject
{
2017-05-23 14:39:33 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Abstract base class that may be implemented to handle new types of data to be dropped in QGIS.
2017-12-15 10:36:55 -04:00
Implementations have three approaches they can use to handle drops.
2017-09-15 18:53:29 +10:00
2017-12-15 10:36:55 -04:00
1. The simplest approach is to implement handeFileDrop() when they need to handle
dropped files (i.e. with mime type "text/uri-list").
2017-09-15 18:53:29 +10:00
2017-12-15 10:36:55 -04:00
2. Reimplement handleCustomUriDrop() when they want to handle dropped custom
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 customUriProviderKey() must match the uri
entry's providerKey.
2017-09-15 18:53:29 +10:00
2017-12-15 10:36:55 -04:00
3. Reimplement 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 handleMimeData() (e.g. dragging files from
explorer to QGIS will lock the explorer window until the drop handling has
been complete). Accordingly handleMimeData() implementations must return
quickly and defer any intensive or slow processing.
2017-05-23 14:39:33 +02:00
.. versionadded:: 3.0
%End
2017-05-23 14:39:33 +02:00
%TypeHeaderCode
#include "qgscustomdrophandler.h"
%End
public:
2017-09-15 18:53:29 +10:00
virtual QString customUriProviderKey() const;
2017-05-23 14:39:33 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Type of custom URI recognized by the handler. This must match
the URI entry's providerKey in order for handleCustomUriDrop()
to be called.
.. seealso:: :py:func:`handleCustomUriDrop`
2017-05-23 14:39:33 +02:00
%End
2017-09-15 18:53:29 +10:00
virtual void handleCustomUriDrop( const QgsMimeDataUtils::Uri &uri ) const;
2017-05-23 14:39:33 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Called from QGIS after a drop event with custom URI known by the handler.
2017-09-15 18:53:29 +10:00
2017-12-15 10:36:55 -04:00
In order for handleCustomUriDrop() to be called, subclasses must
also implement customUriProviderKey() to indicate the providerKey
value which the handler accepts.
2017-09-15 18:53:29 +10:00
.. 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 );
%Docstring
2017-12-15 10:36:55 -04:00
Called when the specified mime ``data`` has been dropped onto QGIS.
2017-12-15 10:36:55 -04:00
The base class implementation does nothing.
2017-12-15 10:36:55 -04:00
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).
2017-12-15 10:36:55 -04:00
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).
%End
virtual bool handleFileDrop( const QString &file );
%Docstring
2019-02-26 19:54:09 +10:00
Called when the specified ``file`` has been dropped onto QGIS. If ``True``
2017-12-15 10:36:55 -04:00
is returned, then the handler has accepted this file and it should not
be further processed (e.g. by other QgsCustomDropHandlers).
The base class implementation does nothing.
2017-12-15 10:36:55 -04:00
This method is not called directly while drop handling is occurring,
so the limitations described in handleMimeData() about returning
quickly do not apply.
2017-05-23 14:39:33 +02:00
%End
};
2017-05-23 14:39:33 +02:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgscustomdrophandler.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/