5.15.2: fix for QTBUG-88309 (QGraphicsItem crash if click right button of mouse)

This commit is contained in:
kleuter 2021-05-14 11:45:07 +02:00
parent 5c7c107075
commit ded22c154d

View File

@ -1942,10 +1942,14 @@ void QWidgetTextControlPrivate::contextMenuEvent(const QPoint &screenPos, const
if (!menu)
return;
menu->setAttribute(Qt::WA_DeleteOnClose);
if (auto *window = static_cast<QWidget *>(parent)->window()->windowHandle()) {
QMenuPrivate::get(menu)->topData()->initialScreenIndex =
if (auto *widget = qobject_cast<QWidget *>(parent)) {
if (auto *window = widget->window()->windowHandle()) {
QMenuPrivate::get(menu)->topData()->initialScreenIndex =
QGuiApplication::screens().indexOf(window->screen());
}
}
menu->popup(screenPos);
#endif
}