[][src]Struct qt_gui::QDropEvent

#[repr(C)]pub struct QDropEvent { /* fields omitted */ }

The QDropEvent class provides an event which is sent when a drag and drop action is completed.

C++ class: QDropEvent.

C++ documentation:

The QDropEvent class provides an event which is sent when a drag and drop action is completed.

When a widget accepts drop events, it will receive this event if it has accepted the most recent QDragEnterEvent or QDragMoveEvent sent to it.

The drop event contains a proposed action, available from proposedAction(), for the widget to either accept or ignore. If the action can be handled by the widget, you should call the acceptProposedAction() function. Since the proposed action can be a combination of Qt::DropAction values, it may be useful to either select one of these values as a default action or ask the user to select their preferred action.

If the proposed drop action is not suitable, perhaps because your custom widget does not support that action, you can replace it with any of the possible drop actions by calling setDropAction() with your preferred action. If you set a value that is not present in the bitwise OR combination of values returned by possibleActions(), the default copy action will be used. Once a replacement drop action has been set, call accept() instead of acceptProposedAction() to complete the drop operation.

The mimeData() function provides the data dropped on the widget in a QMimeData object. This contains information about the MIME type of the data in addition to the data itself.

Methods

impl QDropEvent[src]

pub unsafe fn accept_proposed_action(&self)[src]

Sets the drop action to be the proposed action.

Calls C++ function: void QDropEvent::acceptProposedAction().

C++ documentation:

Sets the drop action to be the proposed action.

See also setDropAction(), proposedAction(), and accept().

pub unsafe fn copy_from(
    &self,
    other: impl CastInto<Ref<QDropEvent>>
) -> Ref<QDropEvent>
[src]

The QDropEvent class provides an event which is sent when a drag and drop action is completed.

Calls C++ function: QDropEvent& QDropEvent::operator=(const QDropEvent& other).

C++ documentation:

The QDropEvent class provides an event which is sent when a drag and drop action is completed.

When a widget accepts drop events, it will receive this event if it has accepted the most recent QDragEnterEvent or QDragMoveEvent sent to it.

The drop event contains a proposed action, available from proposedAction(), for the widget to either accept or ignore. If the action can be handled by the widget, you should call the acceptProposedAction() function. Since the proposed action can be a combination of Qt::DropAction values, it may be useful to either select one of these values as a default action or ask the user to select their preferred action.

If the proposed drop action is not suitable, perhaps because your custom widget does not support that action, you can replace it with any of the possible drop actions by calling setDropAction() with your preferred action. If you set a value that is not present in the bitwise OR combination of values returned by possibleActions(), the default copy action will be used. Once a replacement drop action has been set, call accept() instead of acceptProposedAction() to complete the drop operation.

The mimeData() function provides the data dropped on the widget in a QMimeData object. This contains information about the MIME type of the data in addition to the data itself.

pub unsafe fn drop_action(&self) -> DropAction[src]

Returns the action to be performed on the data by the target. This may be different from the action supplied in proposedAction() if you have called setDropAction() to explicitly choose a drop action.

Calls C++ function: Qt::DropAction QDropEvent::dropAction() const.

C++ documentation:

Returns the action to be performed on the data by the target. This may be different from the action supplied in proposedAction() if you have called setDropAction() to explicitly choose a drop action.

See also setDropAction().

pub unsafe fn keyboard_modifiers(&self) -> QFlags<KeyboardModifier>[src]

Returns the modifier keys that are pressed.

Calls C++ function: QFlags<Qt::KeyboardModifier> QDropEvent::keyboardModifiers() const.

C++ documentation:

Returns the modifier keys that are pressed.

pub unsafe fn mime_data(&self) -> QPtr<QMimeData>[src]

Returns the data that was dropped on the widget and its associated MIME type information.

Calls C++ function: const QMimeData* QDropEvent::mimeData() const.

C++ documentation:

Returns the data that was dropped on the widget and its associated MIME type information.

pub unsafe fn mouse_buttons(&self) -> QFlags<MouseButton>[src]

Returns the mouse buttons that are pressed..

Calls C++ function: QFlags<Qt::MouseButton> QDropEvent::mouseButtons() const.

C++ documentation:

Returns the mouse buttons that are pressed..

pub unsafe fn new_6a(
    pos: impl CastInto<Ref<QPointF>>,
    actions: QFlags<DropAction>,
    data: impl CastInto<Ptr<QMimeData>>,
    buttons: QFlags<MouseButton>,
    modifiers: QFlags<KeyboardModifier>,
    type_: Type
) -> CppBox<QDropEvent>
[src]

Constructs a drop event of a certain type corresponding to a drop at the point specified by pos in the destination widget's coordinate system.

Calls C++ function: [constructor] void QDropEvent::QDropEvent(const QPointF& pos, QFlags<Qt::DropAction> actions, const QMimeData* data, QFlags<Qt::MouseButton> buttons, QFlags<Qt::KeyboardModifier> modifiers, QEvent::Type type = …).

C++ documentation:

Constructs a drop event of a certain type corresponding to a drop at the point specified by pos in the destination widget's coordinate system.

The actions indicate which types of drag and drop operation can be performed, and the drag data is stored as MIME-encoded data in data.

The states of the mouse buttons and keyboard modifiers at the time of the drop are specified by buttons and modifiers.

pub unsafe fn new_5a(
    pos: impl CastInto<Ref<QPointF>>,
    actions: QFlags<DropAction>,
    data: impl CastInto<Ptr<QMimeData>>,
    buttons: QFlags<MouseButton>,
    modifiers: QFlags<KeyboardModifier>
) -> CppBox<QDropEvent>
[src]

Constructs a drop event of a certain type corresponding to a drop at the point specified by pos in the destination widget's coordinate system.

Calls C++ function: [constructor] void QDropEvent::QDropEvent(const QPointF& pos, QFlags<Qt::DropAction> actions, const QMimeData* data, QFlags<Qt::MouseButton> buttons, QFlags<Qt::KeyboardModifier> modifiers).

C++ documentation:

Constructs a drop event of a certain type corresponding to a drop at the point specified by pos in the destination widget's coordinate system.

The actions indicate which types of drag and drop operation can be performed, and the drag data is stored as MIME-encoded data in data.

The states of the mouse buttons and keyboard modifiers at the time of the drop are specified by buttons and modifiers.

pub unsafe fn new_copy(
    other: impl CastInto<Ref<QDropEvent>>
) -> CppBox<QDropEvent>
[src]

The QDropEvent class provides an event which is sent when a drag and drop action is completed.

Calls C++ function: [constructor] void QDropEvent::QDropEvent(const QDropEvent& other).

C++ documentation:

The QDropEvent class provides an event which is sent when a drag and drop action is completed.

When a widget accepts drop events, it will receive this event if it has accepted the most recent QDragEnterEvent or QDragMoveEvent sent to it.

The drop event contains a proposed action, available from proposedAction(), for the widget to either accept or ignore. If the action can be handled by the widget, you should call the acceptProposedAction() function. Since the proposed action can be a combination of Qt::DropAction values, it may be useful to either select one of these values as a default action or ask the user to select their preferred action.

If the proposed drop action is not suitable, perhaps because your custom widget does not support that action, you can replace it with any of the possible drop actions by calling setDropAction() with your preferred action. If you set a value that is not present in the bitwise OR combination of values returned by possibleActions(), the default copy action will be used. Once a replacement drop action has been set, call accept() instead of acceptProposedAction() to complete the drop operation.

The mimeData() function provides the data dropped on the widget in a QMimeData object. This contains information about the MIME type of the data in addition to the data itself.

pub unsafe fn pos(&self) -> CppBox<QPoint>[src]

Returns the position where the drop was made.

Calls C++ function: QPoint QDropEvent::pos() const.

C++ documentation:

Returns the position where the drop was made.

pub unsafe fn pos_f(&self) -> Ref<QPointF>[src]

Returns the position where the drop was made.

Calls C++ function: const QPointF& QDropEvent::posF() const.

C++ documentation:

Returns the position where the drop was made.

pub unsafe fn possible_actions(&self) -> QFlags<DropAction>[src]

Returns an OR-combination of possible drop actions.

Calls C++ function: QFlags<Qt::DropAction> QDropEvent::possibleActions() const.

C++ documentation:

Returns an OR-combination of possible drop actions.

See also dropAction().

pub unsafe fn proposed_action(&self) -> DropAction[src]

Returns the proposed drop action.

Calls C++ function: Qt::DropAction QDropEvent::proposedAction() const.

C++ documentation:

Returns the proposed drop action.

See also dropAction().

pub unsafe fn set_drop_action(&self, action: DropAction)[src]

Sets the action to be performed on the data by the target. Use this to override the proposed action with one of the possible actions.

Calls C++ function: void QDropEvent::setDropAction(Qt::DropAction action).

C++ documentation:

Sets the action to be performed on the data by the target. Use this to override the proposed action with one of the possible actions.

If you set a drop action that is not one of the possible actions, the drag and drop operation will default to a copy operation.

Once you have supplied a replacement drop action, call accept() instead of acceptProposedAction().

See also dropAction().

pub unsafe fn source(&self) -> QPtr<QObject>[src]

If the source of the drag operation is a widget in this application, this function returns that source; otherwise it returns 0. The source of the operation is the first parameter to the QDrag object used instantiate the drag.

Calls C++ function: QObject* QDropEvent::source() const.

C++ documentation:

If the source of the drag operation is a widget in this application, this function returns that source; otherwise it returns 0. The source of the operation is the first parameter to the QDrag object used instantiate the drag.

This is useful if your widget needs special behavior when dragging to itself.

See also QDrag::QDrag().

Trait Implementations

impl CppDeletable for QDropEvent[src]

unsafe fn delete(&self)[src]

Calls C++ function: virtual [destructor] void QDropEvent::~QDropEvent().

impl Deref for QDropEvent[src]

type Target = QEvent

The resulting type after dereferencing.

fn deref(&self) -> &QEvent[src]

Calls C++ function: QEvent* static_cast<QEvent*>(QDropEvent* ptr).

impl DynamicCast<QDragEnterEvent> for QDropEvent[src]

unsafe fn dynamic_cast(ptr: Ptr<QDropEvent>) -> Ptr<QDragEnterEvent>[src]

Calls C++ function: QDragEnterEvent* dynamic_cast<QDragEnterEvent*>(QDropEvent* ptr).

impl DynamicCast<QDragMoveEvent> for QDropEvent[src]

unsafe fn dynamic_cast(ptr: Ptr<QDropEvent>) -> Ptr<QDragMoveEvent>[src]

Calls C++ function: QDragMoveEvent* dynamic_cast<QDragMoveEvent*>(QDropEvent* ptr).

impl DynamicCast<QDropEvent> for QEvent[src]

unsafe fn dynamic_cast(ptr: Ptr<QEvent>) -> Ptr<QDropEvent>[src]

Calls C++ function: QDropEvent* dynamic_cast<QDropEvent*>(QEvent* ptr).

impl StaticDowncast<QDragEnterEvent> for QDropEvent[src]

unsafe fn static_downcast(ptr: Ptr<QDropEvent>) -> Ptr<QDragEnterEvent>[src]

Calls C++ function: QDragEnterEvent* static_cast<QDragEnterEvent*>(QDropEvent* ptr).

impl StaticDowncast<QDragMoveEvent> for QDropEvent[src]

unsafe fn static_downcast(ptr: Ptr<QDropEvent>) -> Ptr<QDragMoveEvent>[src]

Calls C++ function: QDragMoveEvent* static_cast<QDragMoveEvent*>(QDropEvent* ptr).

impl StaticDowncast<QDropEvent> for QEvent[src]

unsafe fn static_downcast(ptr: Ptr<QEvent>) -> Ptr<QDropEvent>[src]

Calls C++ function: QDropEvent* static_cast<QDropEvent*>(QEvent* ptr).

impl StaticUpcast<QDropEvent> for QDragMoveEvent[src]

unsafe fn static_upcast(ptr: Ptr<QDragMoveEvent>) -> Ptr<QDropEvent>[src]

Calls C++ function: QDropEvent* static_cast<QDropEvent*>(QDragMoveEvent* ptr).

impl StaticUpcast<QDropEvent> for QDragEnterEvent[src]

unsafe fn static_upcast(ptr: Ptr<QDragEnterEvent>) -> Ptr<QDropEvent>[src]

Calls C++ function: QDropEvent* static_cast<QDropEvent*>(QDragEnterEvent* ptr).

impl StaticUpcast<QEvent> for QDropEvent[src]

unsafe fn static_upcast(ptr: Ptr<QDropEvent>) -> Ptr<QEvent>[src]

Calls C++ function: QEvent* static_cast<QEvent*>(QDropEvent* ptr).

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> CastInto<U> for T where
    U: CastFrom<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> StaticUpcast<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.