Skip to content

QPainter

QPainter is a widget that provides a painter that you can use in your application.

Example

example_painter.ts
import { QPainter, QWindow, QWidget, WidgetEventTypes } from '@vixen-js/core';
const window = new QWindow();
const center = new QWidget();
const layout new FlexLayout();
center.setLayout(layout);
window.resize(300, 300);
window.addEventListener(WidgetEventTypes.onPaint, (event) => {
const painter = new QPainter();
painter.drawText(40, 40, "Hello Painter");
painter.end();
})
window.show();
(global as any).win = window; // Avoid garbage collection

Learn more about QPainter in: https://doc.qt.io/qt-6/qpainter.html