Struct qt_gui::QDragEnterEvent

source ·
#[repr(C)]
pub struct QDragEnterEvent { /* private fields */ }
Expand description

The QDragEnterEvent class provides an event which is sent to a widget when a drag and drop action enters it.

C++ class: QDragEnterEvent.

C++ documentation:

The QDragEnterEvent class provides an event which is sent to a widget when a drag and drop action enters it.

A widget must accept this event in order to receive the drag move events that are sent while the drag and drop action is in progress. The drag enter event is always immediately followed by a drag move event.

QDragEnterEvent inherits most of its functionality from QDragMoveEvent, which in turn inherits most of its functionality from QDropEvent.

Implementations§

source§

impl QDragEnterEvent

source

pub unsafe fn copy_from( &self, other: impl CastInto<Ref<QDragEnterEvent>> ) -> Ref<QDragEnterEvent>

The QDragEnterEvent class provides an event which is sent to a widget when a drag and drop action enters it.

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

C++ documentation:

The QDragEnterEvent class provides an event which is sent to a widget when a drag and drop action enters it.

A widget must accept this event in order to receive the drag move events that are sent while the drag and drop action is in progress. The drag enter event is always immediately followed by a drag move event.

QDragEnterEvent inherits most of its functionality from QDragMoveEvent, which in turn inherits most of its functionality from QDropEvent.

source

pub unsafe fn new( pos: impl CastInto<Ref<QPoint>>, actions: QFlags<DropAction>, data: impl CastInto<Ptr<QMimeData>>, buttons: QFlags<MouseButton>, modifiers: QFlags<KeyboardModifier> ) -> CppBox<QDragEnterEvent>

Constructs a QDragEnterEvent that represents a drag entering a widget at the given point with mouse and keyboard states specified by buttons and modifiers.

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

C++ documentation:

Constructs a QDragEnterEvent that represents a drag entering a widget at the given point with mouse and keyboard states specified by buttons and modifiers.

The drag data is passed as MIME-encoded information in data, and the specified actions describe the possible types of drag and drop operation that can be performed.

Warning: Do not create a QDragEnterEvent yourself since these objects rely on Qt's internal state.

source

pub unsafe fn new_copy( other: impl CastInto<Ref<QDragEnterEvent>> ) -> CppBox<QDragEnterEvent>

The QDragEnterEvent class provides an event which is sent to a widget when a drag and drop action enters it.

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

C++ documentation:

The QDragEnterEvent class provides an event which is sent to a widget when a drag and drop action enters it.

A widget must accept this event in order to receive the drag move events that are sent while the drag and drop action is in progress. The drag enter event is always immediately followed by a drag move event.

QDragEnterEvent inherits most of its functionality from QDragMoveEvent, which in turn inherits most of its functionality from QDropEvent.

Methods from Deref<Target = QDragMoveEvent>§

source

pub unsafe fn accept_0a(&self)

This is an overloaded function.

Calls C++ function: void QDragMoveEvent::accept().

C++ documentation:

This is an overloaded function.

Calls QDropEvent::accept().

source

pub unsafe fn accept_1a(&self, r: impl CastInto<Ref<QRect>>)

The same as accept(), but also notifies that future moves will also be acceptable if they remain within the rectangle given on the widget. This can improve performance, but may also be ignored by the underlying system.

Calls C++ function: void QDragMoveEvent::accept(const QRect& r).

C++ documentation:

The same as accept(), but also notifies that future moves will also be acceptable if they remain within the rectangle given on the widget. This can improve performance, but may also be ignored by the underlying system.

If the rectangle is empty, drag move events will be sent continuously. This is useful if the source is scrolling in a timer event.

source

pub unsafe fn answer_rect(&self) -> CppBox<QRect>

Returns the rectangle in the widget where the drop will occur if accepted. You can use this information to restrict drops to certain places on the widget.

Calls C++ function: QRect QDragMoveEvent::answerRect() const.

C++ documentation:

Returns the rectangle in the widget where the drop will occur if accepted. You can use this information to restrict drops to certain places on the widget.

source

pub unsafe fn copy_from( &self, other: impl CastInto<Ref<QDragMoveEvent>> ) -> Ref<QDragMoveEvent>

The QDragMoveEvent class provides an event which is sent while a drag and drop action is in progress.

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

C++ documentation:

The QDragMoveEvent class provides an event which is sent while a drag and drop action is in progress.

A widget will receive drag move events repeatedly while the drag is within its boundaries, if it accepts drop events and enter events. The widget should examine the event to see what kind of data it provides, and call the accept() function to accept the drop if appropriate.

The rectangle supplied by the answerRect() function can be used to restrict drops to certain parts of the widget. For example, we can check whether the rectangle intersects with the geometry of a certain child widget and only call acceptProposedAction() if that is the case.

Note that this class inherits most of its functionality from QDropEvent.

source

pub unsafe fn ignore_0a(&self)

This is an overloaded function.

Calls C++ function: void QDragMoveEvent::ignore().

C++ documentation:

This is an overloaded function.

Calls QDropEvent::ignore().

source

pub unsafe fn ignore_1a(&self, r: impl CastInto<Ref<QRect>>)

The opposite of the accept(const QRect&) function. Moves within the rectangle are not acceptable, and will be ignored.

Calls C++ function: void QDragMoveEvent::ignore(const QRect& r).

C++ documentation:

The opposite of the accept(const QRect&) function. Moves within the rectangle are not acceptable, and will be ignored.

Methods from Deref<Target = QDropEvent>§

source

pub unsafe fn accept_proposed_action(&self)

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().

source

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

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.

source

pub unsafe fn drop_action(&self) -> DropAction

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().

source

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

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.

source

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

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.

source

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

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..

source

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

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.

source

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

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.

source

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

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().

source

pub unsafe fn proposed_action(&self) -> DropAction

Returns the proposed drop action.

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

C++ documentation:

Returns the proposed drop action.

See also dropAction().

source

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

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().

source

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

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().

Methods from Deref<Target = QEvent>§

source

pub unsafe fn accept(&self)

Sets the accept flag of the event object, the equivalent of calling setAccepted(true).

Calls C++ function: void QEvent::accept().

C++ documentation:

Sets the accept flag of the event object, the equivalent of calling setAccepted(true).

Setting the accept parameter indicates that the event receiver wants the event. Unwanted events might be propagated to the parent widget.

See also ignore().

source

pub unsafe fn copy_from(&self, other: impl CastInto<Ref<QEvent>>) -> Ref<QEvent>

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

source

pub unsafe fn ignore(&self)

Clears the accept flag parameter of the event object, the equivalent of calling setAccepted(false).

Calls C++ function: void QEvent::ignore().

C++ documentation:

Clears the accept flag parameter of the event object, the equivalent of calling setAccepted(false).

Clearing the accept parameter indicates that the event receiver does not want the event. Unwanted events might be propagated to the parent widget.

See also accept().

source

pub unsafe fn is_accepted(&self) -> bool

the accept flag of the event object

Calls C++ function: bool QEvent::isAccepted() const.

C++ documentation:

the accept flag of the event object

Setting the accept parameter indicates that the event receiver wants the event. Unwanted events might be propagated to the parent widget. By default, isAccepted() is set to true, but don't rely on this as subclasses may choose to clear it in their constructor.

For convenience, the accept flag can also be set with accept(), and cleared with ignore().

Access functions:

bool isAccepted() const
void setAccepted(bool accepted)
source

pub unsafe fn set_accepted(&self, accepted: bool)

the accept flag of the event object

Calls C++ function: void QEvent::setAccepted(bool accepted).

C++ documentation:

the accept flag of the event object

Setting the accept parameter indicates that the event receiver wants the event. Unwanted events might be propagated to the parent widget. By default, isAccepted() is set to true, but don't rely on this as subclasses may choose to clear it in their constructor.

For convenience, the accept flag can also be set with accept(), and cleared with ignore().

Access functions:

bool isAccepted() const
void setAccepted(bool accepted)
source

pub unsafe fn spontaneous(&self) -> bool

Returns true if the event originated outside the application (a system event); otherwise returns false.

Calls C++ function: bool QEvent::spontaneous() const.

C++ documentation:

Returns true if the event originated outside the application (a system event); otherwise returns false.

The return value of this function is not defined for paint events.

source

pub unsafe fn type_(&self) -> Type

Returns the event type.

Calls C++ function: QEvent::Type QEvent::type() const.

C++ documentation:

Returns the event type.

Trait Implementations§

source§

impl CppDeletable for QDragEnterEvent

source§

unsafe fn delete(&self)

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

source§

impl Deref for QDragEnterEvent

source§

fn deref(&self) -> &QDragMoveEvent

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

§

type Target = QDragMoveEvent

The resulting type after dereferencing.
source§

impl DynamicCast<QDragEnterEvent> for QDragMoveEvent

source§

unsafe fn dynamic_cast(ptr: Ptr<QDragMoveEvent>) -> Ptr<QDragEnterEvent>

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

source§

impl DynamicCast<QDragEnterEvent> for QDropEvent

source§

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

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

source§

impl DynamicCast<QDragEnterEvent> for QEvent

source§

unsafe fn dynamic_cast(ptr: Ptr<QEvent>) -> Ptr<QDragEnterEvent>

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

source§

impl StaticDowncast<QDragEnterEvent> for QDragMoveEvent

source§

unsafe fn static_downcast(ptr: Ptr<QDragMoveEvent>) -> Ptr<QDragEnterEvent>

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

source§

impl StaticDowncast<QDragEnterEvent> for QDropEvent

source§

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

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

source§

impl StaticDowncast<QDragEnterEvent> for QEvent

source§

unsafe fn static_downcast(ptr: Ptr<QEvent>) -> Ptr<QDragEnterEvent>

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

source§

impl StaticUpcast<QDragMoveEvent> for QDragEnterEvent

source§

unsafe fn static_upcast(ptr: Ptr<QDragEnterEvent>) -> Ptr<QDragMoveEvent>

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

source§

impl StaticUpcast<QDropEvent> for QDragEnterEvent

source§

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

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

source§

impl StaticUpcast<QEvent> for QDragEnterEvent

source§

unsafe fn static_upcast(ptr: Ptr<QDragEnterEvent>) -> Ptr<QEvent>

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

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T, U> CastInto<U> for T
where U: CastFrom<T>,

source§

unsafe fn cast_into(self) -> U

Performs the conversion. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> StaticUpcast<T> for T

source§

unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>

Convert type of a const pointer. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.