How to create a moveable QWidget in a QWidget show in QGraphicsView

  • Hi everyone.

    Creating a movable QWidget (ParentWidget) in a QGraphicsView is easy and straight forward with QGraphicsScene::addWidget() .

    What I'm trying todo is to add a movable ChildWidget to the ParentWidget, which should be movable inside the ParentWidget only. The ParentWidget shouldn't move during the interaction with the ChildWidget.

    When I override the ChildWidget::mouseMoveEvent it seems to work. But when I move the ChildWidget it starts flickering. The same happens when I moving the ParentWidget.

    It seem that the problem occurs, because of the interference of the QGraphicsView::mouseMoveEvent

    Is this the correct way to solve the movable QWidget inside a QWidget inside a QGraphicsView?
    If yes, how can I avoid the interference of the different mouseMoveEvent methods?

    Thanks for the help.

    Best regards


Log in to reply