QGraphicsItem design question

  • I am working on something that can be described as a "schematic editor". One can place blocks with in- and outputs and connect them.

    I have a class named Component. This class inherits from nothing, it's a basic C++ class. The Component class contains a list of the in- and outputs, information about the date of creation, the author and so on. Now I need to represent this component in a QGraphicsScene.
    My question: Should I make the Component class inherit from the QGraphicsItem class or should I make a separate class, ComponentGraphic, and keep a pointer to that class in my actual Component class? I fear that keeping everything in one class will make it become huge and unmanagable. Having two separate classes can difficult to keep in sync. What's your or the general recommendation?

    Thanks for the help in advance.

Log in to reply