DragEvent QML Type

Provides information about a drag event. More...

Import Statement: import QtQuick

Properties

Methods

Detailed Description

The position of the drag event can be obtained from the x and y properties, and the keys property identifies the drag keys of the event source.

The existence of specific drag types can be determined using the hasColor, hasHtml, hasText, and hasUrls properties.

The list of all supplied formats can be determined using the formats property.

Specific drag types can be obtained using the colorData, html, text, and urls properties.

A string version of any available mimeType can be obtained using getDataAsString.

Property Documentation

accepted : bool

This property holds whether the drag event was accepted by a handler.

The default value is true.


action : enumeration

This property holds the action that the source is to perform on an accepted drop.

The drop action may be one of:

ConstantDescription
Qt.CopyActionCopy the data to the target.
Qt.MoveActionMove the data from the source to the target.
Qt.LinkActionCreate a link from the source to the target.
Qt.IgnoreActionIgnore the action (do nothing with the data).

colorData : color [read-only]

This property holds color data, if any.


drag.source : QtObject

This property holds the source of a drag event.


formats : stringlist [read-only]

This property holds a list of mime type formats contained in the drag data.


hasColor : bool [read-only]

This property holds whether the drag event contains a color item.


hasHtml : bool [read-only]

This property holds whether the drag event contains a html item.


hasText : bool [read-only]

This property holds whether the drag event contains a text item.


hasUrls : bool [read-only]

This property holds whether the drag event contains one or more url items.


html : string [read-only]

This property holds html data, if any.


keys : stringlist [read-only]

This property holds a list of keys identifying the data type or source of a drag event.


proposedAction : flags [read-only]

This property holds the set of actions proposed by the drag source.


supportedActions : flags [read-only]

This property holds the set of actions supported by the drag source.


text : string [read-only]

This property holds text data, if any.


urls : urllist [read-only]

This property holds a list of urls, if any.


x : real [read-only]

This property holds the x coordinate of a drag event.


y : real [read-only]

This property holds the y coordinate of a drag event.


Method Documentation

accept()

accept(enumeration action)

Accepts the drag event.

If an action is specified it will overwrite the value of the action property.


acceptProposedAction()

Accepts the drag event with the proposedAction.


string getDataAsArrayBuffer(string format)

Returns the data for the given format into an ArrayBuffer, which can easily be translated into a QByteArray. format should be one contained in the formats property.


string getDataAsString(string format)

Returns the data for the given format converted to a string. format should be one contained in the formats property.


© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.