I am writing a program using an example

I am interested in two classes there: DiagramItem and Arrow. I leave Arrow practically unchanged, and I replace DiagramItem with my own CircuitElement, which is inherited from QGraphicsItem.

Next, in one of the Arrow methods, the mapFromItem (...) function is called, the first argument of which is const QGraphicsItem *. I pass there an object of my CircuitElement type and the conversion does not occur. Although in the example with DiagramItem works.

    1 answer 1

    Most likely, the thing is that the function of the QGraphicsItem class that you call is not declared as virtual.