Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

In order to deactivate the right click context menu using opencv 2.4.9 namedWindow with Qt 5.2.1 search for file:

opencv\sources\modules\highgui\src\window_QT.cpp

find the following function (usually line 2514):

void DefaultViewPort::contextMenuEvent(QContextMenuEvent* evnt)
{
    if (centralWidget->vect_QActions.size() > 0)
    {
        QMenu menu(this);

        foreach (QAction *a, centralWidget->vect_QActions)
            menu.addAction(a);

        menu.exec(evnt->globalPos());
    }
}

set it to (alternatively just comment the inside of function):

void DefaultViewPort::contextMenuEvent(QContextMenuEvent* evnt)
{
    return;
}

recompile opencv, done.