website/docs/api/generated/classes/qdrag.md
description
↳ QDrag
+ new QDrag(arg?: NativeElement | QObject): QDrag
Overrides Component.constructor
Parameters:
| Name | Type |
|---|---|
arg? | NativeElement | QObject |
Returns: QDrag
• native: NativeElement | null
Inherited from Component.native
▸ defaultAction(): DropAction
Returns the default proposed drop action for this drag operation.
Returns: DropAction
▸ dragCursor(action: DropAction): QPixmap
Returns the drag cursor for the action.
Parameters:
| Name | Type |
|---|---|
action | DropAction |
Returns: QPixmap
▸ 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:
| Name | Type | Default |
|---|---|---|
supportedActions | number | DropAction.MoveAction |
defaultDropAction? | DropAction | - |
Returns: DropAction
▸ hotSpot(): QPoint
Returns the position of the hot spot relative to the top-left corner of the cursor.
Returns: QPoint
▸ mimeData(): QMimeData
Returns the MIME data that is encapsulated by the drag object.
Returns: QMimeData
▸ pixmap(): QPixmap
Returns the pixmap used to represent the data in a drag and drop operation.
Returns: QPixmap
▸ 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:
| Name | Type |
|---|---|
cursor | QPixmap |
action | DropAction |
Returns: void
▸ 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:
| Name | Type |
|---|---|
hotspot | QPoint |
Returns: void
▸ 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:
| Name | Type |
|---|---|
data | QMimeData |
Returns: void
▸ 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:
| Name | Type |
|---|---|
pixmap | QPixmap |
Returns: void
▸ 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