[Interest] QGraphicsView and OpenGL in Qt6

Calogero Mauceri mauceri at actgate.com
Thu Nov 23 10:37:23 CET 2023


Hi all,

We finally decided to port our Qt5 based application to Qt6.
It is a pretty complex application. The main view is a QGraphicsView with
multiple items: images, paths, possible animations and so on.

I remember in Qt5 OpenGL rendering was experimental with lots of issues. My
question is, is QGraphicsView OpenGL rendering more stable in the Qt6 era?
or even better, is it suggested to render using OpenGL? (note: it is a
cross platform application that should run on Windows, Mac or Linux
machines).

To be more specific. The QGraphicsView shows a map. The map is made up of
multiple tiles that should align perfectly. Each tile is a
QGraphicsPixmapItem. After porting to Qt6, it sometimes happens that when
applying a scale to the tiles, then there are gaps between them. It does
not always happen, but it can.
I'm pretty sure the QGraphicsPixmapItems are properly scaled and
positioned. It was working as expected in Qt5.

Here is a screenshot that shows the gaps issue (each rectangle enclosed
tile is a QGraphicsPixmapItem).

[image: Screenshot 2023-11-22 16.29.21.jpg]

If I enable OpenGL view rendering then the view is properly rendered with
no gaps

[image: Screenshot 2023-11-22 16.32.05.jpg]

I wonder if it is safe and suggested to enable OpenGL rendering.

As a side note, if I use the default QWidget based viewport and I apply
Smooth Transformation to each QPixmapGraphicsItem, then the gaps issue
disappears.

setTransformationMode(Qt::SmoothTransformation);

The problem is that we cannot apply any smoothing on those images to avoid
adding artifacts to them.

Thanks in advance for your help,
Calogero

-- 
Calogero Mauceri
Software Engineer

Applied Coherent Technology Corporation (ACT)
www.actgate.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20231123/faef695d/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot 2023-11-22 16.29.21.jpg
Type: image/jpeg
Size: 373199 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20231123/faef695d/attachment-0002.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot 2023-11-22 16.32.05.jpg
Type: image/jpeg
Size: 369894 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20231123/faef695d/attachment-0003.jpg>


More information about the Interest mailing list