QDragMoveEvent Class
QDragMoveEvent クラスは、ドラッグ&ドロップの動作中に送信されるイベントを提供します。詳細...
ヘッダー | #include <QDragMoveEvent> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Gui) target_link_libraries(mytarget PRIVATE Qt6::Gui) |
qmake: | QT += gui |
を継承する: | QDropEvent |
継承元: |
- 継承されたメンバを含むすべてのメンバのリスト
- QDragMoveEvent はイベントクラスに属しています。
パブリック関数
QDragMoveEvent(const QPoint &pos, Qt::DropActions actions, const QMimeData *data, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, QEvent::Type type = DragMove) | |
void | accept(const QRect &rectangle) |
void | accept() |
QRect | answerRect() const |
void | ignore(const QRect &rectangle) |
void | ignore() |
詳細説明
ウィジェットは、drop events とenter events を受け付けると、ドラッグがその境界内にある間、ドラッグ移動イベントを繰り返し受け取ります。ウィジェットは、イベントを調べてdata の種類を確認し、適切であればaccept() 関数を呼び出してドロップを受け入れる必要があります。
answerRect() 関数によって提供される矩形は、ウィジェットの特定の部分へのドロップを制限するために使用することができます。たとえば、矩形が特定の子ウィジェットのジオメトリと交差しているかどうかをチェックし、交差している場合にのみacceptProposedAction() を呼び出すことができます。
このクラスは、ほとんどの機能をQDropEvent から継承していることに注意してください。
QDragEnterEvent 、QDragLeaveEvent 、QDropEventも参照して ください。
メンバ関数ドキュメント
QDragMoveEvent::QDragMoveEvent(const QPoint &pos, Qt::DropActions actions, const QMimeData *data, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, QEvent::Type type = DragMove)
マウスがウィジェット内の指定された位置pos にあることを示す、必要なtype の QDragMoveEvent を作成します。
マウスとキーボードの状態は、buttons とmodifiers で指定され、actions は、可能なドラッグ&ドロップ操作のタイプを記述します。ドラッグデータは、data で MIME エンコードされた情報として渡されます。
警告: QDragMoveEvent を自分で作成しようとしないでください。これらのオブジェクトはQtの内部状態に依存しています。
void QDragMoveEvent::accept(const QRect &rectangle)
accept()と同じですが、ウィジェットに与えられたrectangle の範囲内であれば、将来の移動も受け入れられることを通知します。これはパフォーマンスを向上させますが、基本システムによって無視されることもあります。
矩形が空の場合、ドラッグ移動イベントは継続的に送信されます。これは、ソースがタイマーイベントでスクロールしている場合に便利です。
void QDragMoveEvent::accept()
これはオーバーロードされた関数である。
QDropEvent::accept() を呼び出す。
QRect QDragMoveEvent::answerRect() const
ドロップが許可された場合、ドロップが発生するウィジェット内の矩形を返します。この情報を使用して、ドロップをウィジェット上の特定の場所に制限できます。
void QDragMoveEvent::ignore(const QRect &rectangle)
accept(constQRect&)関数の逆。rectangle 内の移動は受け付けられず、無視される。
void QDragMoveEvent::ignore()
これはオーバーロードされた関数である。
QDropEvent::ignore() を呼び出す。
© 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.