QGraphicsSceneDragDropEvent Class
QGraphicsSceneDragDropEvent クラスは、グラフィックスビューフレームワークでのドラッグ&ドロップのイベントを提供します。詳細...
ヘッダー | #include <QGraphicsSceneDragDropEvent> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Widgets) target_link_libraries(mytarget PRIVATE Qt6::Widgets) |
qmake: | QT += widgets |
継承: | QGraphicsSceneEvent |
パブリック関数
virtual | ~QGraphicsSceneDragDropEvent() |
void | acceptProposedAction() |
Qt::MouseButtons | buttons() const |
Qt::DropAction | dropAction() const |
const QMimeData * | mimeData() const |
Qt::KeyboardModifiers | modifiers() const |
QPointF | pos() const |
Qt::DropActions | possibleActions() const |
Qt::DropAction | proposedAction() const |
QPointF | scenePos() const |
QPoint | screenPos() const |
void | setDropAction(Qt::DropAction action) |
QWidget * | source() const |
詳しい説明
QGraphicsView QWidget によって提供されるドラッグ&ドロップ機能を継承します。ドラッグ アンド ドロップ イベントを受信すると、それを QGraphicsSceneDragDropEvent に変換します。
QGraphicsSceneDragDropEvent は、GraphicsSceneDragEnter、GraphicsSceneDragLeave、GraphicsSceneDragMove、または GraphicsSceneDrop タイプのイベントを格納します。
QGraphicsSceneDragDropEvent は、アイテム、シーン、およびスクリーン座標でのマウスカーソルの位置を含みます。これは、pos()、scenePos()、screenPos() で取得できます。
シーンは、マウスカーソルの下にある、ドロップを受け付ける最初のQGraphicsItem にイベントを送信します。グラフィックアイテムは、setAcceptDrops() でドロップを受け付けるように設定されます。
メンバー関数ドキュメント
[virtual noexcept]
QGraphicsSceneDragDropEvent::~QGraphicsSceneDragDropEvent()
オブジェクトを破壊する。
void QGraphicsSceneDragDropEvent::acceptProposedAction()
すなわち、ドロップアクションが提案されたアクションに設定される。これは等しい:
setDropAction(proposedAction());
この関数を使用する場合、accept()
を呼び出すべきではない。
dropAction(),setDropAction(),proposedAction()も参照のこと 。
Qt::MouseButtons QGraphicsSceneDragDropEvent::buttons() const
このマウスイベントが発生したときに、どのボタンがマウス上で押されたかを示すQt::MouseButtons 値を返します。
Qt::MouseButtonsも参照してください 。
Qt::DropAction QGraphicsSceneDragDropEvent::dropAction() const
このドラッグ&ドロップで実行されたアクションを返します。これはドロップのレシーバーが設定する必要があり、QDrag::exec() によって返されます。
setDropAction() およびacceptProposedAction()も参照 。
const QMimeData *QGraphicsSceneDragDropEvent::mimeData() const
この関数は、イベントの MIME データを返す。
Qt::KeyboardModifiers QGraphicsSceneDragDropEvent::modifiers() const
ドラッグ&ドロップイベントが作成されたときに押されたキーボード修飾子を返します。
Qt::KeyboardModifiersも参照してください 。
QPointF QGraphicsSceneDragDropEvent::pos() const
イベントを送信したビューに対する、イベントのマウス位置を返す。
QGraphicsView 、screenPos()、scenePos()も参照してください 。
Qt::DropActions QGraphicsSceneDragDropEvent::possibleActions() const
ドラッグ&ドロップで可能なドロップアクションを返します。
Qt::DropActionsも参照ください 。
Qt::DropAction QGraphicsSceneDragDropEvent::proposedAction() const
提案された、つまり優先されるドロップアクションを返す。このアクションは、possibleActions()
で定義されているアクションのいずれかでなければならない。
Qt::DropAction およびpossibleActions()も参照 。
QPointF QGraphicsSceneDragDropEvent::scenePos() const
マウスの位置をシーン座標で返します。
pos() およびscreenPos()も参照してください 。
QPoint QGraphicsSceneDragDropEvent::screenPos() const
画面に対するマウスの相対位置を返します。
void QGraphicsSceneDragDropEvent::setDropAction(Qt::DropAction action)
action possible actionsこの関数を使用する場合は、acceptProposedAction()
の代わりにaccept()
を呼び出す。
dropAction()、accept()、possibleActions()も参照 。
QWidget *QGraphicsSceneDragDropEvent::source() const
この関数は、QGraphicsSceneDragDropEvent を作成したQGraphicsView を返す。
© 2025 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.