Important: Please read the Qt Code of Conduct -

Ideas for integrated help system with QGraphicsScene & QGraphicsWidget?

  • I'm in charge of finding an integrated help solution for our software that is built using QGraphicsScene and QGraphicsWidget(s). I'm not finding many hits out there.

    I was looking into QHelp, but it looks like it is used primarily for vanilla QtGui applications.

    Does anyone have any suggestions on the best route to take?

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    What do you mean by integrated ? Showed in the scene ?

  • Thank you for your response.

    We are envisioning a system that has three possible stages:

    1. In context-specific situations (ie, while on a GraphicsWidget), the ability to hit a key or button to bring up a help widget.

    2. Also in context-sensitive situations, right-clicking on a button/graphics object to get something similar to tool-tip help.

    3. More general help at higher levels that is less context-specific.

    I appreciate you asking the right question here. The requirement comes from an external customer for an "integrated help system." These three specifics are my best guess at how that might look.

    Thank you,

  • you need to know where you are, as you say in which context, and what key/mouse events to treat ... since you have to do this and for qt's native widgets too, I would think to use event filters: a help class inheriting QObject which will be installed as filter from/for any relevant context

  • You could use QGraphicsItem::setData to store either context-sensitive help data or a help context id that can be used to retrieve this data from your central help system. You can also create common base classes for your GraphicsItems, and handle context sensitive help behavior there.

  • How does one receive a keypress event inside a QGraphicsWidget? When I set the setFocus() in the widget, I don't get the events inside of the event() method.

  • The docs on QGraphicsWidget::event state that it handles only certain types of events.

    For keyboard events:

    -) You can reimplement QGraphicsItem::keyPressEvent and keyReleaseEvent.

    -) You can reimplement QGraphicsItem::sceneEvent and receive the events in there.

    -) You can add sceneEventFilter to the item.

    -) You can install an eventFilter on the QGraphicsView, and catch the events before they are dispatched to the scene

    -) You can install a global events filter.

    It all depends on what exactly you need to do...

Log in to reply