Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QQuickDragAttachedPrivate Class Reference

#include <qquickdrag_p_p.h>

+ Inheritance diagram for QQuickDragAttachedPrivate:
+ Collaboration diagram for QQuickDragAttachedPrivate:

Public Member Functions

 QQuickDragAttachedPrivate ()
 
void itemGeometryChanged (QQuickItem *, QQuickGeometryChange, const QRectF &) override
 \qmltype Drag \instantiates QQuickDrag \inqmlmodule QtQuick
 
void itemParentChanged (QQuickItem *, QQuickItem *parent) override
 
void updatePosition ()
 
void restartDrag ()
 
void deliverEnterEvent ()
 
void deliverMoveEvent ()
 
void deliverLeaveEvent ()
 
void deliverEvent (QQuickWindow *window, QEvent *event)
 
void start (Qt::DropActions supportedActions)
 
Qt::DropAction startDrag (Qt::DropActions supportedActions)
 
void setTarget (QQuickItem *item)
 
QMimeDatacreateMimeData () const
 \qmlattachedsignal QtQuick::Drag::dragStarted()
 
void loadPixmap ()
 
- Public Member Functions inherited from QObjectPrivate
void ensureExtraData ()
 
 QObjectPrivate (int version=QObjectPrivateVersion)
 
virtual ~QObjectPrivate ()
 
void deleteChildren ()
 
void clearBindingStorage ()
 
void checkForIncompatibleLibraryVersion (int version) const
 
void setParent_helper (QObject *)
 
void moveToThread_helper ()
 
void setThreadData_helper (QThreadData *currentData, QThreadData *targetData, QBindingStatus *status)
 
QObjectList receiverList (const char *signal) const
 
void ensureConnectionData ()
 
void addConnection (int signal, Connection *c)
 
int signalIndex (const char *signalName, const QMetaObject **meta=nullptr) const
 
bool isSignalConnected (uint signalIdx, bool checkDeclarative=true) const
 
bool maybeSignalConnected (uint signalIndex) const
 
bool isDeclarativeSignalConnected (uint signalIdx) const
 
void connectNotify (const QMetaMethod &signal)
 
void disconnectNotify (const QMetaMethod &signal)
 
void reinitBindingStorageAfterThreadMove ()
 
virtual std::string flagsForDumping () const
 
virtual void writeToDebugStream (QDebug &) const
 
QtPrivate::QPropertyAdaptorSlotObjectgetPropertyAdaptorSlotObject (const QMetaProperty &property)
 
- Public Member Functions inherited from QObjectData
 QObjectData ()=default
 
virtual ~QObjectData ()=0
 
QMetaObjectdynamicMetaObject () const
 
- Public Member Functions inherited from QQuickItemChangeListener
virtual ~QQuickItemChangeListener ()
 
virtual void itemSiblingOrderChanged (QQuickItem *)
 
virtual void itemVisibilityChanged (QQuickItem *)
 
virtual void itemEnabledChanged (QQuickItem *)
 
virtual void itemOpacityChanged (QQuickItem *)
 
virtual void itemDestroyed (QQuickItem *)
 
virtual void itemChildAdded (QQuickItem *, QQuickItem *)
 
virtual void itemChildRemoved (QQuickItem *, QQuickItem *)
 
virtual void itemRotationChanged (QQuickItem *)
 
virtual void itemImplicitWidthChanged (QQuickItem *)
 
virtual void itemImplicitHeightChanged (QQuickItem *)
 
virtual void itemFocusChanged (QQuickItem *, Qt::FocusReason)
 
virtual QQuickAnchorsPrivateanchorPrivate ()
 

Static Public Member Functions

static QQuickDragAttachedPrivateget (QQuickDragAttached *attached)
 
- Static Public Member Functions inherited from QObjectPrivate
static bool removeConnection (Connection *c)
 
static QObjectPrivateget (QObject *o)
 
static const QObjectPrivateget (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)
 

Public Attributes

QQuickDragGrabber dragGrabber
 
QPointer< QObjectsource
 
QPointer< QObjecttarget
 
QPointer< QQuickWindowwindow
 
QQuickItemattachedItem
 
QQuickDragMimeDatamimeData
 
Qt::DropAction proposedAction
 
Qt::DropActions supportedActions
 
bool active: 1
 
bool listening: 1
 
bool inEvent: 1
 
bool dragRestarted: 1
 
bool itemMoved: 1
 
bool eventQueued: 1
 
bool overrideActions: 1
 
QPointF hotSpot
 
QUrl imageSource
 
QSize imageSourceSize
 
QQuickPixmap pixmapLoader
 
QStringList keys
 
QVariantMap externalMimeData
 
QQuickDrag::DragType dragType
 
- Public Attributes inherited from QObjectPrivate
ExtraDataextraData
 
QAtomicPointer< QThreadDatathreadData
 
QAtomicPointer< ConnectionDataconnections
 
union { 
 
   QObject *   currentChildBeingDeleted 
 
   QAbstractDeclarativeData *   declarativeData 
 
};  
 
QAtomicPointer< QtSharedPointer::ExternalRefCountDatasharedRefcount
 
- Public Attributes inherited from QObjectData
QObjectq_ptr
 
QObjectparent
 
QObjectList children
 
uint isWidget: 1
 
uint blockSig: 1
 
uint wasDeleted: 1
 
uint isDeletingChildren: 1
 
uint sendChildEvents: 1
 
uint receiveChildEvents: 1
 
uint isWindow: 1
 
uint deleteLaterCalled: 1
 
uint isQuickItem: 1
 
uint willBeWidget: 1
 
uint wasWidget: 1
 
uint receiveParentEvents: 1
 
uint unused: 20
 
QAtomicInt postedEvents
 
QDynamicMetaObjectDatametaObject
 
QBindingStorage bindingStorage
 

Additional Inherited Members

- Public Types inherited from QObjectPrivate
typedef void(* StaticMetaCallFunction) (QObject *, QMetaObject::Call, int, void **)
 
using ConnectionDataPointer = QExplicitlySharedDataPointer<ConnectionData>
 

Detailed Description

Definition at line 32 of file qquickdrag_p_p.h.

Constructor & Destructor Documentation

◆ QQuickDragAttachedPrivate()

QQuickDragAttachedPrivate::QQuickDragAttachedPrivate ( )
inline

Definition at line 42 of file qquickdrag_p_p.h.

Member Function Documentation

◆ createMimeData()

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.

See also
drop()

Definition at line 713 of file qquickdrag.cpp.

References QMap< Key, T >::asKeyValueRange(), QStringEncoder::encode(), error, externalMimeData, QImageWriter::imageFormatsForMimeType(), QUrl::isValid(), QStringConverter::isValid(), mimeData, mimeType, Q_FALLTHROUGH, qmlWarning(), 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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deliverEnterEvent()

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deliverEvent()

void QQuickDragAttachedPrivate::deliverEvent ( QQuickWindow * window,
QEvent * event )

Definition at line 148 of file qquickdrag.cpp.

References dragGrabber, QQuickWindowPrivate::get(), inEvent, Q_ASSERT, and window.

Referenced by deliverEnterEvent(), deliverLeaveEvent(), and deliverMoveEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deliverLeaveEvent()

void QQuickDragAttachedPrivate::deliverLeaveEvent ( )

Definition at line 139 of file qquickdrag.cpp.

References deliverEvent(), and window.

Referenced by startDrag().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deliverMoveEvent()

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.

+ Here is the call graph for this function:

◆ get()

static QQuickDragAttachedPrivate * QQuickDragAttachedPrivate::get ( QQuickDragAttached * attached)
inlinestatic

Definition at line 39 of file qquickdrag_p_p.h.

References QObjectPrivate::get().

+ Here is the call graph for this function:

◆ itemGeometryChanged()

void QQuickDragAttachedPrivate::itemGeometryChanged ( QQuickItem * ,
QQuickGeometryChange change,
const QRectF &  )
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.

import QtQuick
Item {
width: 200; height: 200
DropArea {
x: 75; y: 75
width: 50; height: 50
Rectangle {
anchors.fill: parent
color: "green"
visible: parent.containsDrag
}
}
Rectangle {
x: 10; y: 10
width: 20; height: 20
color: "red"
Drag.active: dragArea.drag.active
Drag.hotSpot.x: 10
Drag.hotSpot.y: 10
MouseArea {
id: dragArea
anchors.fill: parent
drag.target: parent
}
}
}

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.

See also
{Qt Quick Examples - Drag and Drop}

Reimplemented from QQuickItemChangeListener.

Definition at line 61 of file qquickdrag.cpp.

References active, itemMoved, QQuickGeometryChange::positionChange(), and updatePosition().

+ Here is the call graph for this function:

◆ itemParentChanged()

void QQuickDragAttachedPrivate::itemParentChanged ( QQuickItem * ,
QQuickItem * parent )
overridevirtual

Reimplemented from QQuickItemChangeListener.

Definition at line 69 of file qquickdrag.cpp.

References active, attachedItem, dragRestarted, restartDrag(), updatePosition(), window, and QQuickItem::window().

+ Here is the call graph for this function:

◆ loadPixmap()

void QQuickDragAttachedPrivate::loadPixmap ( )

Definition at line 805 of file qquickdrag.cpp.

References context, imageSource, QQuickPixmap::load(), pixmapLoader, and qmlContext().

+ Here is the call graph for this function:

◆ restartDrag()

void QQuickDragAttachedPrivate::restartDrag ( )

Definition at line 92 of file qquickdrag.cpp.

References dragRestarted, eventQueued, QCoreApplication::postEvent(), and QEvent::User.

Referenced by itemParentChanged().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setTarget()

void QQuickDragAttachedPrivate::setTarget ( QQuickItem * item)

◆ start()

void QQuickDragAttachedPrivate::start ( Qt::DropActions supportedActions)

Definition at line 545 of file qquickdrag.cpp.

References active, attachedItem, deliverEnterEvent(), dragGrabber, dragRestarted, emit, QQuickItemPrivate::Geometry, QQuickItemPrivate::get(), itemMoved, listening, mimeData, QQuickItemPrivate::Parent, Q_ASSERT, supportedActions, and QQuickDragGrabber::target().

+ Here is the call graph for this function:

◆ startDrag()

Qt::DropAction QQuickDragAttachedPrivate::startDrag ( Qt::DropActions supportedActions)

Definition at line 816 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().

+ Here is the call graph for this function:

◆ updatePosition()

void QQuickDragAttachedPrivate::updatePosition ( )

Definition at line 82 of file qquickdrag.cpp.

References eventQueued, itemMoved, QCoreApplication::postEvent(), and QEvent::User.

Referenced by itemGeometryChanged(), and itemParentChanged().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ active

bool QQuickDragAttachedPrivate::active

Definition at line 81 of file qquickdrag_p_p.h.

Referenced by itemGeometryChanged(), itemParentChanged(), start(), and startDrag().

◆ attachedItem

QQuickItem* QQuickDragAttachedPrivate::attachedItem

Definition at line 77 of file qquickdrag_p_p.h.

Referenced by deliverEnterEvent(), deliverMoveEvent(), itemParentChanged(), and start().

◆ dragGrabber

QQuickDragGrabber QQuickDragAttachedPrivate::dragGrabber

Definition at line 72 of file qquickdrag_p_p.h.

Referenced by deliverEvent(), deliverMoveEvent(), and start().

◆ dragRestarted

bool QQuickDragAttachedPrivate::dragRestarted

Definition at line 84 of file qquickdrag_p_p.h.

Referenced by deliverEnterEvent(), itemParentChanged(), restartDrag(), and start().

◆ dragType

QQuickDrag::DragType QQuickDragAttachedPrivate::dragType

Definition at line 94 of file qquickdrag_p_p.h.

◆ eventQueued

bool QQuickDragAttachedPrivate::eventQueued

Definition at line 86 of file qquickdrag_p_p.h.

Referenced by restartDrag(), and updatePosition().

◆ externalMimeData

QVariantMap QQuickDragAttachedPrivate::externalMimeData

Definition at line 93 of file qquickdrag_p_p.h.

Referenced by createMimeData().

◆ hotSpot

QPointF QQuickDragAttachedPrivate::hotSpot

Definition at line 88 of file qquickdrag_p_p.h.

Referenced by deliverEnterEvent(), deliverMoveEvent(), and startDrag().

◆ imageSource

QUrl QQuickDragAttachedPrivate::imageSource

Definition at line 89 of file qquickdrag_p_p.h.

Referenced by loadPixmap().

◆ imageSourceSize

QSize QQuickDragAttachedPrivate::imageSourceSize

Definition at line 90 of file qquickdrag_p_p.h.

◆ inEvent

bool QQuickDragAttachedPrivate::inEvent

Definition at line 83 of file qquickdrag_p_p.h.

Referenced by deliverEvent().

◆ itemMoved

bool QQuickDragAttachedPrivate::itemMoved

◆ keys

QStringList QQuickDragAttachedPrivate::keys

Definition at line 92 of file qquickdrag_p_p.h.

Referenced by deliverEnterEvent().

◆ listening

bool QQuickDragAttachedPrivate::listening

Definition at line 82 of file qquickdrag_p_p.h.

Referenced by start().

◆ mimeData

QQuickDragMimeData* QQuickDragAttachedPrivate::mimeData

Definition at line 78 of file qquickdrag_p_p.h.

Referenced by createMimeData(), deliverEnterEvent(), deliverMoveEvent(), and start().

◆ overrideActions

bool QQuickDragAttachedPrivate::overrideActions

Definition at line 87 of file qquickdrag_p_p.h.

Referenced by deliverEnterEvent().

◆ pixmapLoader

QQuickPixmap QQuickDragAttachedPrivate::pixmapLoader

Definition at line 91 of file qquickdrag_p_p.h.

Referenced by loadPixmap(), and startDrag().

◆ proposedAction

Qt::DropAction QQuickDragAttachedPrivate::proposedAction

Definition at line 79 of file qquickdrag_p_p.h.

Referenced by deliverEnterEvent(), and deliverMoveEvent().

◆ source

QPointer<QObject> QQuickDragAttachedPrivate::source

Definition at line 74 of file qquickdrag_p_p.h.

Referenced by deliverEnterEvent().

◆ supportedActions

Qt::DropActions QQuickDragAttachedPrivate::supportedActions

Definition at line 80 of file qquickdrag_p_p.h.

Referenced by deliverEnterEvent(), start(), and startDrag().

◆ target

QPointer<QObject> QQuickDragAttachedPrivate::target

Definition at line 75 of file qquickdrag_p_p.h.

◆ window

QPointer<QQuickWindow> QQuickDragAttachedPrivate::window

The documentation for this class was generated from the following files: