[Interest] QGraphicsView status

Shawn Rutledge shawn.rutledge at digia.com
Mon Jul 7 13:34:24 CEST 2014


On Sun, Jul 06, 2014 at 03:39:29PM -0400, Jonathan Wilkes wrote:
> QGraphicsView looks like it has what I need to do this.  Qt Quick looks 
> like it has a lot of great features but is conspicuously missing Bezier 
> curves, ellipses, or even line primitives.  (I see it has an HTML5-style 
> canvas but I don't want to reinvent svg-style inheritance inside that.)  

What do you mean about inheritance?

> So if QGraphicsView is going to continue to be actively maintained it 
> looks like the best fit.

There aren't plans at this point to add any new features though, only to
keep it working, whereas QtQuick is being actively developed.  But QtQuick
has been developed around a small set of graphics primitives of which it's
easy to get GPUs to render large quantities.  Bezier curves and such aren't
there because proper anti-aliasing of them is difficult, and there would be
scaling issues if you try to render too many.  I also think it's a hole which 
needs to be filled at some point.  But GPUs are developed according to what 
game developers need nowadays, so there is not as much emphasis on accelerating
vector graphics as there should be, IMO (in the world in general, not just
in the Qt project).  So the easy way is to use the raster engine 
(QPainter, QPainterPath and friends), which happens to use the CPU to
do the work instead of the GPU (usually), but at least it can do the
antialiasing.  QGraphicsView and the QtQuick Canvas API both do that.
The rendering is done on-demand into a texture instead of trying to render
any kind of vector graphics that you like from scratch in every frame
at 60FPS.  Personally I don't think that goal is impossible, just 
more difficult and not done yet.  And another benefit of QPainter et al.
is support for printing.

So I think for these reasons QGraphicsView will be around for some time,
but I hope the future for vector graphics on the GPU eventually gets 
bright enough that we can have everything in Qt Quick some day.

Anyway there is a playground project with some vector graphics stuff
(Qt.labs.shapes):
https://codereview.qt-project.org/#/admin/projects/playground/scenegraph
into which I added a bezier "connector"
https://codereview.qt-project.org/#/c/74246/
based on some of Gunnar's earlier work.  Everything there needs refinement
which is why it's in a playground project.




More information about the Interest mailing list