diff --git a/lcl/interfaces/qt/qtwidgets.pas b/lcl/interfaces/qt/qtwidgets.pas index a2b785c729..f98bd2a97c 100644 --- a/lcl/interfaces/qt/qtwidgets.pas +++ b/lcl/interfaces/qt/qtwidgets.pas @@ -16270,6 +16270,21 @@ begin case QEvent_type(Event) of LCLQt_PopupMenuTriggered: begin + {$IFDEF HASX11} + // make interface snappy after menuitem triggers + if Assigned(Application) and not Application.Terminated then + begin + if QApplication_activePopupWidget = nil then + begin + if QApplication_activeModalWidget <> nil then + QWidget_repaint(QApplication_activeModalWidget) + else + if QApplication_activeWindow <> nil then + QWidget_repaint(QApplication_activeWindow); + QCoreApplication_processEvents(QEventLoopAllEvents); + end; + end; + {$ENDIF} FillChar(Msg{%H-}, SizeOf(Msg), 0); Msg.msg := LM_ACTIVATE; if MenuItemEnabled then diff --git a/lcl/interfaces/qt5/qtwidgets.pas b/lcl/interfaces/qt5/qtwidgets.pas index 9d8bc9394d..b32affab4e 100644 --- a/lcl/interfaces/qt5/qtwidgets.pas +++ b/lcl/interfaces/qt5/qtwidgets.pas @@ -16350,6 +16350,21 @@ begin case QEvent_type(Event) of LCLQt_PopupMenuTriggered: begin + {$IFDEF HASX11} + // make interface snappy after menuitem triggers + if Assigned(Application) and not Application.Terminated then + begin + if QApplication_activePopupWidget = nil then + begin + if QApplication_activeModalWidget <> nil then + QWidget_repaint(QApplication_activeModalWidget) + else + if QApplication_activeWindow <> nil then + QWidget_repaint(QApplication_activeWindow); + QCoreApplication_processEvents(QEventLoopAllEvents); + end; + end; + {$ENDIF} FillChar(Msg{%H-}, SizeOf(Msg), 0); Msg.msg := LM_ACTIVATE; if MenuItemEnabled then