Solved Drawing on QGraphicsView
-
Hi,
So I worked on a simple program where a user could choose some preset images that they could click and add to a canvas Widget. My plan is for the user to click on a space where they want text or an image drawn. The program saves the location x, y and other details in a QVector and the painter/ graphicsView draws whatever is in the QVector.
But now I want to move that over to using QGraphicsView, since I've read that the QGraphicsView is built on QPainter, do I still need to use QPaintEvent() and update() to draw or could I just do that in MousePressEvent()?
-
Hi
You would insert a QGraphicsPixmapItem and it draws automatically when needed.
So yes mostly just to capture where use clicks and then add item there.Make sure to read about the coordinate system or it will drive you nuts.
Maybe check out this.
it adds come circles etc
https://www.bogotobogo.com/Qt/Qt5_QGraphicsView_QGraphicsScene.php -
Hi
You would insert a QGraphicsPixmapItem and it draws automatically when needed.
So yes mostly just to capture where use clicks and then add item there.Make sure to read about the coordinate system or it will drive you nuts.
Maybe check out this.
it adds come circles etc
https://www.bogotobogo.com/Qt/Qt5_QGraphicsView_QGraphicsScene.php -
This post is deleted!