DropArea QML Type
用于指定某个区域的拖放处理方式。更多...
| Import Statement: | import QtQuick |
| Inherits: |
属性
- containsDrag : bool
- drag.source : QtObject
- drag
- keys : stringlist
信号
- dropped(DragEvent drop)
- entered(DragEvent drag)
- exited()
- positionChanged(DragEvent drag)
详细说明
DropArea 是一个不可见的控件,当其他控件被拖拽经过它时,它会接收相关事件。
Drag 附加属性可用于在项目被拖拽经过 DropArea 时向其发出通知。
keys 属性可用于过滤不包含匹配键的拖拽事件。
drag.source 属性会作为拖放目标上的接收方,传递给拖放事件的源。
另请参阅 《Qt Quick 示例——拖放》。
属性文档
containsDrag : bool [read-only]
该属性用于标识DropArea 当前是否包含任何被拖动的项目。
drag.source : QtObject [read-only]
该属性保存了拖动操作的源。
drag group
这些属性保存了上一次拖动事件的坐标。
keys : stringlist
该属性保存了DropArea 可接受的拖动键列表。
如果未列出任何键,则DropArea 将接受来自任何拖动源的事件;否则,拖动源必须至少有一个兼容的键。
另请参阅 QtQuick::Drag::keys 。
信号文档
dropped(DragEvent drop)
当在DropArea 的边界内发生drop 事件时,会触发此信号。
注意: 相应的处理程序 为onDropped 。
entered(DragEvent drag)
当drag 进入DropArea 的边界时,会发出此信号。
注意: 相应的处理程序 为onEntered 。
exited()
当拖拽操作超出DropArea 的边界时,会触发此信号。
注意: 相应的处理程序 为onExited 。
positionChanged(DragEvent drag)
当drag 的位置发生变化时,会发出此信号。
注意: 相应的处理程序 为onPositionChanged 。
© 2026 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.