6.0.0-rc4Source

QRasterWindow Class

The QRasterWindow class is a convenience class for using QPainter on a QWindow. More…

Header#include <QRasterWindow>
CMaketarget_link_libraries(app PRIVATE Nt::Gui)
ModuleNt GUI C++ Classes
InheritsQPaintDeviceWindow

List of all members, including inherited members

Public Functions

QRasterWindow(QWindow *parent = nullptr)
~QRasterWindow()

Detailed Description

A raster window paints with QPainter into a software backing store. Reimplement paintEvent() and paint on the window:

class Clock : public QRasterWindow {
protected:
    void paintEvent(QPaintEvent *) override
    {
        QPainter painter(this);
        painter.fillRect(rect(), Qt::white);
        painter.setBrush(Qt::darkBlue);
        painter.drawEllipse(20, 20, 100, 100);
    }
};

See also QPaintDeviceWindow and QPainter.

Differences from Qt

The class adds nothing to QPaintDeviceWindow, and the parent argument must be nullptr because Nt has no child windows.

Member Function Documentation

[explicit] QRasterWindow::QRasterWindow(QWindow *parent = nullptr)

Constructs a raster window. parent is accepted for compatibility and must be nullptr.

[override] QRasterWindow::~QRasterWindow()

Destroys the window.