이 페이지에서

QPaintEvent Class

QPaintEvent 클래스에는 페인트 이벤트에 대한 이벤트 매개변수가 포함되어 있습니다. 더 보기...

헤더: #include <QPaintEvent>
CMake: find_package(Qt6 REQUIRED COMPONENTS Gui)
target_link_libraries(mytarget PRIVATE Qt6::Gui)
qmake: QT += gui
상속: QEvent

공개 함수

QPaintEvent(const QRect &paintRect)
QPaintEvent(const QRegion &paintRegion)
const QRect &rect() const
const QRegion &region() const

보호된 함수

QPaintEvent(QPaintEvent &&)
QPaintEvent &operator=(QPaintEvent &&)
QPaintEvent &operator=(const QPaintEvent &other)

상세 설명

Paint 이벤트는 위젯을 업데이트해야 하는 위젯으로 전송됩니다. 예를 들어, 덮고 있던 위젯이 이동하여 위젯의 일부가 노출된 경우입니다.

이 이벤트에는 업데이트가 필요한 영역( region())과 해당 영역의 경계 사각형( rect())이 포함되어 있습니다. 많은 위젯이 region()을 제대로 활용할 수 없고, rect()이 region()보다 훨씬 빠를 수 있기 때문에 두 가지가 모두 제공됩니다.

자동 클리핑

페인트 이벤트 처리 중 페인팅은 region()에 따라 클리핑됩니다. 이 클리핑은 Qt의 페인트 시스템에 의해 수행되며, 페인트 장치에 그리기 위해 사용되는 QPainter 에 적용될 수 있는 어떤 클리핑과도 독립적입니다.

결과적으로, 새로 생성된 QPainter 에서 QPainter::clipRegion()가 반환하는 값은 페인트 시스템에서 사용하는 클립 영역을 반영하지 않습니다.

QPainter, QWidget::update(), QWidget::repaint(), QWidget::paintEvent()도 참조하십시오 .

멤버 함수 문서

[explicit] QPaintEvent::QPaintEvent(const QRect &paintRect)

업데이트해야 할 사각형을 사용하여 페인트 이벤트 객체를 생성합니다. 해당 영역은 ` paintRect`로 지정됩니다.

[explicit] QPaintEvent::QPaintEvent(const QRegion &paintRegion)

업데이트해야 할 영역을 사용하여 페인트 이벤트 객체를 생성합니다. 이 영역은 ` paintRegion`로 지정됩니다.

[protected delete] QPaintEvent::QPaintEvent(QPaintEvent &&)

QPaintEvent 의 인스턴스를 이동 생성합니다. 이 함수는 삭제되었습니다.

const QRect &QPaintEvent::rect() const

업데이트해야 할 사각형을 반환합니다.

region() 및 QPainter::setClipRect()도 참조하십시오 .

const QRegion &QPaintEvent::region() const

업데이트해야 할 영역을 반환합니다.

rect() 및 QPainter::setClipRegion()도 참조하십시오 .

[protected delete] QPaintEvent &QPaintEvent::operator=(QPaintEvent &&)

other 를 이 QPaintEvent 인스턴스에 할당합니다. 이 함수는 삭제됩니다.

[noexcept protected default] QPaintEvent &QPaintEvent::operator=(const QPaintEvent &other)

other 를 이 QPaintEvent 인스턴스에 복사-할당합니다.

© 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.