DragEvent

Provides information about a drag event. More...

Import Statement: import QtQuick 2.11

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:

  • Qt.CopyAction Copy the data to the target.
  • Qt.MoveAction Move the data from the source to the target.
  • Qt.LinkAction Create a link from the source to the target.
  • Qt.IgnoreAction Ignore the action (do nothing with the data).

colorData : color

This property holds color data, if any.

This QML property was introduced in Qt 5.2.


drag.source : Object

This property holds the source of a drag event.


formats : stringlist

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

This QML property was introduced in Qt 5.2.


hasColor : bool

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

This QML property was introduced in Qt 5.2.


hasHtml : bool

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

This QML property was introduced in Qt 5.2.


hasText : bool

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

This QML property was introduced in Qt 5.2.


hasUrls : bool

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

This QML property was introduced in Qt 5.2.


html : string

This property holds html data, if any.

This QML property was introduced in Qt 5.2.


keys : stringlist

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


proposedAction : flags

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

This QML property was introduced in Qt 5.2.


supportedActions : flags

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


text : string

This property holds text data, if any.

This QML property was introduced in Qt 5.2.


urls : urllist

This property holds a list of urls, if any.

This QML property was introduced in Qt 5.2.


x : real

This property holds the x coordinate of a drag event.


y : real

This property holds the y coordinate of a drag event.


Method Documentation

accept(enumeration action)


accept()


acceptProposedAction()

Accepts the drag event with the proposedAction.

This QML method was introduced in Qt 5.2.


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.

This QML method was introduced in Qt 5.5.


string getDataAsString(string format)

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

This QML method was introduced in Qt 5.2.


Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support