Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QGraphicsView + AnchorUnderMouse + setContextMenu (zoom issue)



  • As example - elasticnodes

    code adds a menu
    @
    node6->setPos(50, 0);
    node7->setPos(-50, 50);
    node8->setPos(0, 50);
    node9->setPos(50, 50);

    addAction(new QAction(QObject::tr("Anchor"),this));
    addAction(new QAction(QObject::tr("Under"),this));
    addAction(new QAction(QObject::tr("Mouse"),this));
    addAction(new QAction(QObject::tr("Not"),this));
    addAction(new QAction(QObject::tr("Work"),this));
    addAction(new QAction(QObject::tr("Click"),this));
    addAction(new QAction(QObject::tr("To"),this));
    addAction(new QAction(QObject::tr("Repair"),this));
    setContextMenuPolicy(Qt::ActionsContextMenu);
    

    }@

    If you click outside of the menu - does not work AnchorUnderMouse.
    If you click a menu item - and it works well

    Qt-4.8.5
    Kubuntu 12.04_64


Log in to reply