You can subclass Qwidget, and redefine at least paintEvent(QPaintEvent * event)
and resizeEvent(QResizeEvent * event)
.
I assume your widget hold a initial list of pairs of QRect
and QColor
. When a resize event occurs you compute a rendering list of QRect with basic relative arithmetic. When a paint even occurs you use this rendering list to fill with the color.
You can even allow to modify colors with mouse events for some neat rendering.
All of these can be done with Qml too, and may be even easier.