DragEvent QML Type

Provides information about a drag event. 更多...

导入语句: import QtQuick 2.12

特性

方法

详细描述

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 ,和 hasUrls 特性。

The list of all supplied formats can be determined using the 格式 特性。

Specific drag types can be obtained using the colorData , html , text ,和 urls 特性。

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

特性文档编制

accepted : bool

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

默认值为 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.

该特性在 Qt 5.2 引入。


drag.source : Object

This property holds the source of a drag event.


格式 : stringlist

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

该特性在 Qt 5.2 引入。


hasColor : bool

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

该特性在 Qt 5.2 引入。


hasHtml : bool

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

该特性在 Qt 5.2 引入。


hasText : bool

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

该特性在 Qt 5.2 引入。


hasUrls : bool

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

该特性在 Qt 5.2 引入。


html : string

This property holds html data, if any.

该特性在 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.

该特性在 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.

该特性在 Qt 5.2 引入。


urls : urllist

This property holds a list of urls, if any.

该特性在 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.


方法文档编制

accept ()

accept ( enumeration action )

Accepts the drag event.

If an action is specified it will overwrite the value of the action 特性。


acceptProposedAction ()

Accepts the drag event with the proposedAction .

This method was introduced in Qt 5.2.


string getDataAsArrayBuffer ( string format )

返回数据为给定 format into an ArrayBuffer, which can easily be translated into a QByteArray . format should be one contained in the 格式 特性。

该方法在 Qt 5.5 引入。


string getDataAsString ( string format )

返回数据为给定 format converted to a string. format should be one contained in the 格式 特性。

This method was introduced in Qt 5.2.