When to use QGraphicsWidget/Item over QWidget?
-
Hello! I am building a relatively simple diagraming tool and the docs don't really make it clear when to choose QGraphics* over QWidget and basic painting. The diagrams aren't going to get terribly complex (see attached photo) so I am not concerned about performance for sheer number of items. However, I do want to be able to pinch and zoom very smoothly as well as implement a very nice drawing response with the Apple pencil.
So should I choose QGraphics* or QWidget?
Probably own't exceed this level of complexity:
Thanks!
-
I stumbled across the section in the documentation called Graphics View Architecture. While it doesn't answer my question directly, it does give me enough information to make a decision considering I am already quite familiar with QWidget painting.
The graphics view appears to be the best choice in my case because it offers all the mouse events, antialiasing and double-precision rendering, collision detection, etc.
I guess the problems was that I couldn't find it from the start page.
-
Suggest to use qgraphics as qgraphics items are not heavy
-
I stumbled across the section in the documentation called Graphics View Architecture. While it doesn't answer my question directly, it does give me enough information to make a decision considering I am already quite familiar with QWidget painting.
The graphics view appears to be the best choice in my case because it offers all the mouse events, antialiasing and double-precision rendering, collision detection, etc.
I guess the problems was that I couldn't find it from the start page.
-
Cool. You have made the right choice. Enjoy the painting now. You can move the issue to solved also.
-
And just to be sure, you see it
http://doc.qt.io/qt-5/qtwidgets-graphicsview-diagramscene-example.html -
@mrjj said in When to use QGraphicsWidget/Item over QWidget?:
Oh man, thanks for that example!