Qt Quick vs Graphics View Framework (QGraphicsScene)
Asked Answered
R

1

6

I skimmed through new features of Qt5 and Qt Quick and don't really understand how it differs from the Graphics View Framework (QGraphicsScene) feature wise. It uses QML but beside that:

  1. Can Qt Quick do something that QGraphicsScene can't? For example particle effects.
  2. Is Qt Quick faster than QGraphicsScene? "Faster" meaning more FPS while displaying 1000 moving elements?

I am making a tower defense game and have been using QGraphicsScene and now I wonder whether I should switch to Qt Quick.

Rabin answered 28/4, 2013 at 20:19 Comment(0)
N
7

Qt5 and Qt Quick 2 should give a nice performance boost, thanks to "scene graph", which is the underlying engine and basically written from scratch for Qt Quick of Qt5, to take full advantage of OpenGL, and have high frame rate as a design goal from the start.

In addition to performance, I think it count's as a big feature, that you can describe the GUI, transitions, animations and all that, in a much nicer way with QML. There's some learning curve, writing declarative GUI code is quite different from writing more direct C++ code to do similar things, but it's totally worth it.

In Qt4, I don't think QML is going to give any peformance advantage, as I think (did not verify now) there it is written on top QGraphicsView stuff.

So, to summarize: Go for Qt5 and Qt Quick2, and Learn QML for desiging the GUI. Have game logic done in C++ for performance (tower defence games can have quite a bit of stuff happening at the extreme case).

Edit: Blog (old so may be slightly out of date in details) about why then scene graph implementation was created: http://blog.qt.io/blog/2011/05/31/qml-scene-graph-in-master/

Nora answered 28/4, 2013 at 21:39 Comment(2)
Can you provide any benchmarks or trustworthy sources that show the performance increase of scene graph compared to graphics view?Rabin
@problemofficer Maybe, I added a link to an old blog, which has one benchmark graph, which shows Qt4 QML1 vs. Qt5 QML2 fps difference for one case.Nora

© 2022 - 2024 — McMap. All rights reserved.