MVC pattern with QGraphicsItem
-
Hi, I have made a simple MVC with a box that contains text. I have controller, which handles all the requests from outside, the model which stores the data and view which represents the cube itself on QGraphicsScene. My question is how to register a double-click, or mouse release on the view, when it cannot send signals, nor can include the controller, because of circular include?
-
@Desfell said in MVC pattern with QGraphicsItem:
QGraphicsItem cannot emit signals :{
No but QGraphicsObject Class adds just that if it's what you are missing.
-
Hi and welcome to devnet,
Why do you have circular dependencies ?
What type of item are you using ?
-
@SGaist No circular dependencies just yet - that was just a horrible idea I had and thankfully did not implement :D So far there is a QGraphicsItem that is the view, with another class, of QWidget, which is supposed to be the controller. I am just curious how to detect on the controller, that the view was double-clicked for example.
-
Emit a signal from the view that you will connect on the controller.
-
@Desfell said in MVC pattern with QGraphicsItem:
QGraphicsItem cannot emit signals :{
No but QGraphicsObject Class adds just that if it's what you are missing.