Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
src_gui_painting_qregion.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3#include <QPaintEvent>
4#include <QPainter>
5
7struct MyWidget : public QPaintDevice
8{
10};
11
14{
15 QRegion r1(QRect(100, 100, 200, 80), // r1: elliptic region
17 QRegion r2(QRect(100, 120, 90, 30)); // r2: rectangular region
18 QRegion r3 = r1.intersected(r2); // r3: intersection
19
20 QPainter painter(this);
22 // ... // paint clipped graphics
23}
25
26} // src_gui_painting_qregion
The QPaintEvent class contains event parameters for paint events.
Definition qevent.h:486
The QPainter class performs low-level painting on widgets and other paint devices.
Definition qpainter.h:46
void setClipRegion(const QRegion &, Qt::ClipOperation op=Qt::ReplaceClip)
Sets the clip region to the given region using the specified clip operation.
\inmodule QtCore\reentrant
Definition qrect.h:30
QRect intersected(const QRect &other) const noexcept
Definition qrect.h:415
The QRegion class specifies a clip region for a painter.
Definition qregion.h:27
@ Ellipse
Definition qregion.h:29
QRect r1(100, 200, 11, 16)
[0]
QRect r2(QPoint(100, 200), QSize(11, 16))
QPainter painter(this)
[7]