Subclassing QGraphicsProxyWidget vs. QGraphicsWidget vs. QGraphicsItem to create custom graphic objects

  • Hi,

    I am trying to implement a node editor GUI similar to the ones you can find in Blender, Houdini or Nuke, using the QGraphicsScene and QGraphicsView classes.

    • A node is represented by a rectangle shape (QGraphicsPathItem/QGraphicsRectangleItem/QFrame or QDialog in a QGraphicsWidget or QGraphicsProxyWidget, etc..).
    • The node has several connectors representing an input or an output.
    • Outputs can be connected to inputs (QGraphicsPathItem/QGraphicsLineItem).

    Something that could look similar to this (but a lot simpler for now):
    ! node graph screenshot)!

    I am confused about the various ways to achieve this. Many of the Qt Graphicsview examples directly subclass the QDialog class and add them to the scene with scene->addWidget(myNode). In the "Basic Graphics Layouts Example":, a QGraphicsWidget is used instead. Yet some other examples directly subclass the QGraphicsProxyWidget class to create the node, in which they create a QDialog or a QFrame which they set as the proxy widget with setWidget(nodeWidget).

    I'm confused!
    1- What do you think would be the best way to go? Any advantages/disadvantages?
    2- What is the difference between subclassing the QGraphicsWidget class and subclassing the QGraphicsProxyWidget class?
    3- Any other suggestions?

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.