This class abstracts drag and drop events. More...
#include <Radiant/DropEvent.hpp>
Public Member Functions | |
| DropEvent (const QList< QUrl > &urls, Nimble::Vector2 loc) | |
| Creates a drop event that contains a collection of URLs. More... | |
| DropEvent (const QDropEvent &de, Nimble::Vector2 loc) | |
| Create a drop event from QDropEvent. More... | |
| bool | hasUrls () const |
| Check whether the event contains URLs. More... | |
| Nimble::Vector2 | location () const |
| Returns the location of the drop event in scene coordinates. More... | |
| QList< QUrl > | urls () const |
| Return the list of URLs. More... | |
| ~DropEvent () | |
| Deletes the drop event. | |
Static Public Member Functions | |
| static void | addDropListener (DropListener *l) |
| Registers a DropListener object. More... | |
| static bool | deliverDropToListeners (const DropEvent &e) |
| Deliver a DropEvent to all the registered listeners. More... | |
| static void | removeDropListener (DropListener *l) |
| Removes a DropListener object from the list of registered listeners. More... | |
This class abstracts drag and drop events.
Instances of this class are generated when a drag and drop action is completed. The DropEvent is an experimental part of Cornerstone, and its API may change yet.
| Radiant::DropEvent::DropEvent | ( | const QList< QUrl > & | urls, |
| Nimble::Vector2 | loc | ||
| ) |
Creates a drop event that contains a collection of URLs.
| urls | List of urls to store with event |
| loc | Location of drop in Application's scene coordinates |
| Radiant::DropEvent::DropEvent | ( | const QDropEvent & | de, |
| Nimble::Vector2 | loc | ||
| ) |
Create a drop event from QDropEvent.
| de | QDropEvent to copy |
| loc | drop location in Application's scene coordinates |
|
static |
Registers a DropListener object.
After calling this function, the listener is active and will receive drop events. This function is thread-safe.
| l | The listener to be registered. |
|
static |
Deliver a DropEvent to all the registered listeners.
This function iterates through the list of DropListener object that have been registered with addDropListener. For each listener it will call the Radiant::DropListener::dropEvent, until the the list is exhausted or one of the function calls returns true. This function is thread-safe.
| e | The DropEvent to be delivered |
| bool Radiant::DropEvent::hasUrls | ( | ) | const |
Check whether the event contains URLs.
| Nimble::Vector2 Radiant::DropEvent::location | ( | ) | const |
Returns the location of the drop event in scene coordinates.
In most cases, you need to convert this location to object coordinates. For Widgets, this can be done with MultiWidgets::Widget::mapFromScene function - assuming that there is no complex view hierarchy that causes extra transformations.
|
static |
Removes a DropListener object from the list of registered listeners.
After calling this function, the listener is no longer active and will receive no further drop events. This function is thread-safe.
| l | The listener to be removed. |
| QList<QUrl> Radiant::DropEvent::urls | ( | ) | const |