![]() |
Qt 6.x
The Qt SDK
|
#include <qquickdrag_p_p.h>
Static Public Member Functions | |
static QQuickDragAttachedPrivate * | get (QQuickDragAttached *attached) |
![]() | |
static bool | removeConnection (Connection *c) |
static QObjectPrivate * | get (QObject *o) |
static const QObjectPrivate * | get (const QObject *o) |
template<typename Func1 , typename Func2 > | |
static QMetaObject::Connection | connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiverPrivate, Func2 slot, Qt::ConnectionType type=Qt::AutoConnection) |
template<typename Func1 , typename Func2 > | |
static bool | disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiverPrivate, Func2 slot) |
static QMetaObject::Connection | connectImpl (const QObject *sender, int signal_index, const QObject *receiver, void **slot, QtPrivate::QSlotObjectBase *slotObj, int type, const int *types, const QMetaObject *senderMetaObject) |
static QMetaObject::Connection | connect (const QObject *sender, int signal_index, QtPrivate::QSlotObjectBase *slotObj, Qt::ConnectionType type) |
static QMetaObject::Connection | connect (const QObject *sender, int signal_index, const QObject *receiver, QtPrivate::QSlotObjectBase *slotObj, Qt::ConnectionType type) |
static bool | disconnect (const QObject *sender, int signal_index, void **slot) |
static bool | disconnect (const QObject *sender, int signal_index, const QObject *receiver, void **slot) |
Additional Inherited Members | |
![]() | |
typedef void(* | StaticMetaCallFunction) (QObject *, QMetaObject::Call, int, void **) |
using | ConnectionDataPointer = QExplicitlySharedDataPointer< ConnectionData > |
Definition at line 32 of file qquickdrag_p_p.h.
|
inline |
Definition at line 42 of file qquickdrag_p_p.h.
QMimeData * QQuickDragAttachedPrivate::createMimeData | ( | ) | const |
\qmlattachedsignal QtQuick::Drag::dragStarted()
This signal is emitted when a drag is started with the \l startDrag() method or when it is started automatically using the \l dragType property.
\qmlattachedsignal QtQuick::Drag::dragFinished(DropAction dropAction)
This signal is emitted when a drag finishes and the drag was started with the \l startDrag() method or started automatically using the \l dragType property.
dropAction holds the action accepted by the target item.
Definition at line 671 of file qquickdrag.cpp.
References QMap< Key, T >::asKeyValueRange(), QByteArray::constData(), QListSpecialMethodsBase< T >::contains(), QStringEncoder::encode(), error, externalMimeData, QImageWriter::imageFormatsForMimeType(), QUrl::isValid(), QStringConverter::isValid(), mimeData, mimeType, Q_FALLTHROUGH, qmlWarning(), QList< T >::reserve(), QMimeData::setData(), QMimeData::setHtml(), QMimeData::setImageData(), QMimeData::setText(), QMimeData::setUrls(), QImageWriter::supportedMimeTypes(), text, QList< T >::toList(), QString::toUtf8(), url, and QImageWriter::write().
Referenced by startDrag().
void QQuickDragAttachedPrivate::deliverEnterEvent | ( | ) |
Definition at line 102 of file qquickdrag.cpp.
References attachedItem, deliverEvent(), dragRestarted, hotSpot, itemMoved, keys, QQuickItem::mapToScene(), mimeData, Qt::NoButton, Qt::NoModifier, overrideActions, proposedAction, QQuickDropEventEx::setProposedAction(), source, supportedActions, QPointF::toPoint(), window, and QQuickItem::window().
Referenced by start().
void QQuickDragAttachedPrivate::deliverEvent | ( | QQuickWindow * | window, |
QEvent * | event | ||
) |
Definition at line 148 of file qquickdrag.cpp.
References QQuickWindowPrivate::deliveryAgentPrivate(), dragGrabber, QQuickWindowPrivate::get(), inEvent, Q_ASSERT, and window.
Referenced by deliverEnterEvent(), deliverLeaveEvent(), and deliverMoveEvent().
void QQuickDragAttachedPrivate::deliverLeaveEvent | ( | ) |
Definition at line 139 of file qquickdrag.cpp.
References deliverEvent(), and window.
Referenced by startDrag().
void QQuickDragAttachedPrivate::deliverMoveEvent | ( | ) |
Definition at line 122 of file qquickdrag.cpp.
References attachedItem, deliverEvent(), dragGrabber, emit, hotSpot, itemMoved, QQuickItem::mapToScene(), mimeData, Qt::NoButton, Qt::NoModifier, proposedAction, QQuickDropEventEx::setProposedAction(), QQuickDragGrabber::target(), QPointF::toPoint(), and window.
|
inlinestatic |
Definition at line 39 of file qquickdrag_p_p.h.
References QObjectPrivate::get().
|
overridevirtual |
\qmltype Drag \instantiates QQuickDrag \inqmlmodule QtQuick
For specifying drag and drop events for moved Items.
Using the Drag attached property, any Item can be made a source of drag and drop events within a scene.
When a drag is \l active on an item, any change in that item's position will generate a drag event that will be sent to any DropArea that intersects with the new position of the item. Other items which implement drag and drop event handlers can also receive these events.
The following snippet shows how an item can be dragged with a MouseArea. However, dragging is not limited to mouse drags; anything that can move an item can generate drag events, including touch events, animations and bindings.
A drag can be terminated either by canceling it with Drag.cancel() or setting Drag.active to false, or it can be terminated with a drop event by calling Drag.drop(). If the drop event is accepted, Drag.drop() will return the \l {supportedActions}{drop action} chosen by the recipient of the event, otherwise it will return Qt.IgnoreAction.
Reimplemented from QQuickItemChangeListener.
Definition at line 61 of file qquickdrag.cpp.
References active, itemMoved, QQuickGeometryChange::positionChange(), and updatePosition().
|
overridevirtual |
Reimplemented from QQuickItemChangeListener.
Definition at line 69 of file qquickdrag.cpp.
References active, attachedItem, dragRestarted, restartDrag(), updatePosition(), window, and QQuickItem::window().
void QQuickDragAttachedPrivate::restartDrag | ( | ) |
Definition at line 92 of file qquickdrag.cpp.
References dragRestarted, eventQueued, QCoreApplication::postEvent(), and QEvent::User.
Referenced by itemParentChanged().
void QQuickDragAttachedPrivate::setTarget | ( | QQuickItem * | item | ) |
void QQuickDragAttachedPrivate::start | ( | Qt::DropActions | supportedActions | ) |
Definition at line 503 of file qquickdrag.cpp.
References active, QQuickItemPrivate::addItemChangeListener(), attachedItem, deliverEnterEvent(), dragGrabber, dragRestarted, emit, QQuickItemPrivate::Geometry, QQuickItemPrivate::get(), itemMoved, listening, mimeData, QQuickItemPrivate::Parent, Q_ASSERT, supportedActions, and QQuickDragGrabber::target().
Qt::DropAction QQuickDragAttachedPrivate::startDrag | ( | Qt::DropActions | supportedActions | ) |
Definition at line 764 of file qquickdrag.cpp.
References active, createMimeData(), QObject::deleteLater(), deliverLeaveEvent(), emit, QDrag::exec(), QPixmap::fromImage(), hotSpot, QQuickPixmap::image(), QQuickPixmap::isReady(), pixmapLoader, QGuiApplicationPrivate::platformIntegration(), QDrag::setHotSpot(), QDrag::setMimeData(), QDrag::setPixmap(), supportedActions, and QPointF::toPoint().
void QQuickDragAttachedPrivate::updatePosition | ( | ) |
Definition at line 82 of file qquickdrag.cpp.
References eventQueued, itemMoved, QCoreApplication::postEvent(), and QEvent::User.
Referenced by itemGeometryChanged(), and itemParentChanged().
bool QQuickDragAttachedPrivate::active |
Definition at line 80 of file qquickdrag_p_p.h.
Referenced by itemGeometryChanged(), itemParentChanged(), start(), and startDrag().
QQuickItem* QQuickDragAttachedPrivate::attachedItem |
Definition at line 76 of file qquickdrag_p_p.h.
Referenced by deliverEnterEvent(), deliverMoveEvent(), itemParentChanged(), and start().
QQuickDragGrabber QQuickDragAttachedPrivate::dragGrabber |
Definition at line 71 of file qquickdrag_p_p.h.
Referenced by deliverEvent(), deliverMoveEvent(), and start().
bool QQuickDragAttachedPrivate::dragRestarted |
Definition at line 83 of file qquickdrag_p_p.h.
Referenced by deliverEnterEvent(), itemParentChanged(), restartDrag(), and start().
QQuickDrag::DragType QQuickDragAttachedPrivate::dragType |
Definition at line 92 of file qquickdrag_p_p.h.
bool QQuickDragAttachedPrivate::eventQueued |
Definition at line 85 of file qquickdrag_p_p.h.
Referenced by restartDrag(), and updatePosition().
QVariantMap QQuickDragAttachedPrivate::externalMimeData |
Definition at line 91 of file qquickdrag_p_p.h.
Referenced by createMimeData().
QPointF QQuickDragAttachedPrivate::hotSpot |
Definition at line 87 of file qquickdrag_p_p.h.
Referenced by deliverEnterEvent(), deliverMoveEvent(), and startDrag().
QUrl QQuickDragAttachedPrivate::imageSource |
Definition at line 88 of file qquickdrag_p_p.h.
bool QQuickDragAttachedPrivate::inEvent |
Definition at line 82 of file qquickdrag_p_p.h.
Referenced by deliverEvent().
bool QQuickDragAttachedPrivate::itemMoved |
Definition at line 84 of file qquickdrag_p_p.h.
Referenced by deliverEnterEvent(), deliverMoveEvent(), itemGeometryChanged(), start(), and updatePosition().
QStringList QQuickDragAttachedPrivate::keys |
Definition at line 90 of file qquickdrag_p_p.h.
Referenced by deliverEnterEvent().
bool QQuickDragAttachedPrivate::listening |
Definition at line 81 of file qquickdrag_p_p.h.
Referenced by start().
QQuickDragMimeData* QQuickDragAttachedPrivate::mimeData |
Definition at line 77 of file qquickdrag_p_p.h.
Referenced by createMimeData(), deliverEnterEvent(), deliverMoveEvent(), and start().
bool QQuickDragAttachedPrivate::overrideActions |
Definition at line 86 of file qquickdrag_p_p.h.
Referenced by deliverEnterEvent().
QQuickPixmap QQuickDragAttachedPrivate::pixmapLoader |
Definition at line 89 of file qquickdrag_p_p.h.
Referenced by startDrag().
Qt::DropAction QQuickDragAttachedPrivate::proposedAction |
Definition at line 78 of file qquickdrag_p_p.h.
Referenced by deliverEnterEvent(), and deliverMoveEvent().
Definition at line 73 of file qquickdrag_p_p.h.
Referenced by deliverEnterEvent().
Qt::DropActions QQuickDragAttachedPrivate::supportedActions |
Definition at line 79 of file qquickdrag_p_p.h.
Referenced by deliverEnterEvent(), start(), and startDrag().
Definition at line 74 of file qquickdrag_p_p.h.
QPointer<QQuickWindow> QQuickDragAttachedPrivate::window |
Definition at line 75 of file qquickdrag_p_p.h.
Referenced by deliverEnterEvent(), deliverEvent(), deliverLeaveEvent(), deliverMoveEvent(), and itemParentChanged().