QDragMoveEvent Class

QDragMoveEvent 클래스는 드래그 앤 드롭 동작이 진행되는 동안 전송되는 이벤트를 제공합니다. 더 보기...

헤더: #include <QDragMoveEvent>
CMake: find_package(Qt6 REQUIRED COMPONENTS Gui)
target_link_libraries(mytarget PRIVATE Qt6::Gui)
qmake: QT += gui
상속합니다: QDropEvent
상속 대상:

QDragEnterEvent

공용 함수

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 eventsenter 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를 생성합니다.

마우스와 키보드 상태는 buttonsmodifiers 로 지정되며, 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(const QRect&) 함수의 반대입니다. 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.