Проблема отображения при использовании QT QMENU OBJECT EVENCE RIGHT EVER [закрыто]C++

Программы на C++. Форум разработчиков
Anonymous
Проблема отображения при использовании QT QMENU OBJECT EVENCE RIGHT EVER [закрыто]

Сообщение Anonymous »

OS: Win10 Enterprise LTSC 21H2
QT version: 5.14.2
Language: C++
Issue: As the picture, when to click the right button, the context menu will not display immediately sometimes.
Code:

Код: Выделить всё

    projectTreeView->setContextMenuPolicy(Qt::CustomContextMenu);
menu = new QMenu;
menu->addAction(createAction);
menu->addAction(deleteAction);

connect(projectTreeView, &QTreeView::customContextMenuRequested, this, [=](const QPoint &pos){
QModelIndex index = projectTreeView->indexAt(pos);
if (!index.isValid())
return;
else
{
qDebug() exec(QCursor::pos());
}
});


Подробнее здесь: https://stackoverflow.com/questions/796 ... lick-event

Вернуться в «C++»