Skip to main content

QDrag

description

Hierarchy

Index

Constructors

Properties

Methods

Constructors

constructor

+ new QDrag(arg?: NativeElement | QObject): QDrag

Overrides Component.constructor

Parameters:

NameType
arg?NativeElement | QObject

Returns: QDrag

Properties

native

native: NativeElement | null

Inherited from Component.native

Methods

defaultAction

defaultAction(): DropAction

Returns the default proposed drop action for this drag operation.

Returns: DropAction


dragCursor

dragCursor(action: DropAction): QPixmap

Returns the drag cursor for the action.

Parameters:

NameType
actionDropAction

Returns: QPixmap


exec

exec(supportedActions: number, defaultDropAction?: DropAction): DropAction

Starts the drag and drop operation and returns a value indicating the requested drop action when it is completed. The drop actions that the user can choose from are specified in supportedActions. The default proposed action will be selected among the allowed actions in the following order: Move, Copy and Link.

Parameters:

NameTypeDefault
supportedActionsnumberDropAction.MoveAction
defaultDropAction?DropAction-

Returns: DropAction


hotSpot

hotSpot(): QPoint

Returns the position of the hot spot relative to the top-left corner of the cursor.

Returns: QPoint


mimeData

mimeData(): QMimeData

Returns the MIME data that is encapsulated by the drag object.

Returns: QMimeData


pixmap

pixmap(): QPixmap

Returns the pixmap used to represent the data in a drag and drop operation.

Returns: QPixmap


setDragCursor

setDragCursor(cursor: QPixmap, action: DropAction): void

Sets the drag cursor for the action. This allows you to override the default native cursors. To revert to using the native cursor for action pass in a null QPixmap as cursor.

Parameters:

NameType
cursorQPixmap
actionDropAction

Returns: void


setHotSpot

setHotSpot(hotspot: QPoint): void

Sets the position of the hot spot relative to the top-left corner of the pixmap used to the point specified by hotspot.

Parameters:

NameType
hotspotQPoint

Returns: void


setMimeData

setMimeData(data: QMimeData): void

Sets the data to be sent to the given MIME data. Ownership of the data is transferred to the QDrag object.

Parameters:

NameType
dataQMimeData

Returns: void


setPixmap

setPixmap(pixmap: QPixmap): void

Sets pixmap as the pixmap used to represent the data in a drag and drop operation. You can only set a pixmap before the drag is started.

Parameters:

NameType
pixmapQPixmap

Returns: void


supportedActions

supportedActions(): number

Returns the set of possible drop actions for this drag operation.

Returns: number


Static cancel

cancel(): void

Cancels a drag operation initiated by Qt.

Returns: void