Solved Draw numbers when you're using QgraphicsView and QGraphicsScene
I have in my UI a QGraphicsView in that i am using QGraphicsScene to show a pic. Also, upon the pic i am drawing lines to separate the pic in cells.
However, i have to draw a number when the user click upon the imagen. For example, if you click the first time, in the position i have to draw a number one, with the second time click, i have to draw a number two...
Does someone know how i can do that?
QGraphicsScene scene; scene.addText("Hello, world!"); QGraphicsView view(&scene); view.show();
Keep a counter that you increment each time you click on the scene. Once that done, add a new text item as @jsulm suggested and position it accordingly where the click happened.
thanks so much! Now is working :)