Nominate our 2022 Qt Champions!

When does QGraphicsWidget::size() become valid?

  • I have a custom QGraphicsWidget within a parent QGraphicsWidget, but not in a layout.

    To position my child graphicsWidget, I need to take it's size into account.

    When is the proper time in the code of my parent QGraphicsWidget to update the child graphicsWidget's position?

    I can't do it in the constructor, the size isn't yet valid then.
    I could connect to the geometryChanged() signal of the child graphicsWidget, but would also get position changes, not only size changes. This is a bit tricky since I am going to change the position.
    The first time I paint is too late, it would flicker.

    Other suggestions?

Log in to reply