I’m trying to port an MCF/C++ widget to QT6.
The widget has a custom paint function to draw the part of the image that’s visible to the user.
Practically all examples showed a QLabel as a child for a ScrollArea which doesn’t let me override the Widgets (QLabel) paint event.
Several design options came to mind with QT6:
- Inherit from QWidget, have QScrollArea and some child widget to fill it (QWidget?).
- Inherit from QScrollArea and have some child widget to fill it (QWidget?).
- Inherit from QWidget, have QScrollbars as members and override paintEvent for the class
My widget should catch all mouse events so the user can drag/pan the image, zoom in/out, etc.
The drawing/paint callback of the image must be my function as it needs to know, the scroll positions (v/h), zoom level, and the client area to draw on. I don’t want to draw massive images only to be cropped by the QScrollArea (e.g. support at least zoom of x256).
Any suggestions on how to design this w/o reimplementing the wheel?