QDrag
description
Hierarchy
↳ QDrag
Index
Constructors
Properties
Methods
- defaultAction
- dragCursor
- exec
- hotSpot
- mimeData
- pixmap
- setDragCursor
- setHotSpot
- setMimeData
- setPixmap
- supportedActions
- cancel
Constructors
constructor
+ new QDrag(arg?
: NativeElement | QObject): QDrag
Overrides Component.constructor
Parameters:
Name | Type |
---|---|
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:
Name | Type |
---|---|
action | DropAction |
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:
Name | Type | Default |
---|---|---|
supportedActions | number | DropAction.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:
Name | Type |
---|---|
cursor | QPixmap |
action | DropAction |
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:
Name | Type |
---|---|
hotspot | QPoint |
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:
Name | Type |
---|---|
data | QMimeData |
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:
Name | Type |
---|---|
pixmap | QPixmap |
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