PDA

View Full Version : Alternative to QGrpahicsView?



derda17
20th August 2020, 13:16
I'm maintaining a module of a desktop software visualizing industrial data, imagine multiple coordinate axes, lines, custom shapes, lots of information next to the coordinate axes. Most of the stuff is interactive and performance is critical. It originates in QT3 or even QT2 and essentially uses QPainter on a QImage displayed in a raw QWidget.

Extending it becomes more and more of a burden and I was looking into refactoring it to a more modern and flexible QGraphicsView /-scene pattern, but stumbled upon posts like Should you be using QGraphicsView (https://www.qt.io/blog/2017/01/19/should-you-be-using-qgraphicsview).

Is this warning still up-to-date?
What are reasonable alternatives when using a widget-based desktop application?

d_stranz
20th August 2020, 17:00
I develop large C++, QWidget-based desktop applications with tens to often more than 100 QWidget-based views, dialogs, or other components. I use the Graphics / View framework often, because often I must derive a customized QGraphicsItem to represent something specialized and it is far easier to let the framework take care of coordinates and transformations that to write it by hand using QPainter.

I have kept QtQuick on the radar since it was first developed, and I can't see that I would ever use it for a desktop application of the type I develop (and from the sound of it, the type you develop as well). It is hard enough with UI implementation split between Qt Designer UI files and C++ code. Adding QML into that mix would make managing (and debugging) a complex project nearly impossible.

My personal opinion, based on what I do for a living. QtQuick / QML are probably the tools of choice for embedded or mobile apps with relatively straightforward UIs, but that's not where I work.