Windows QPA: Emulate aboutToHide(), aboutToShow() signals of QPlatformMenu
Wrap the call to TrackPopupMenu accordingly.
Complements 7849aa6e96.
Task-number: QTBUG-64628
Change-Id: Ia370e566266e96ab690ce5ed41d06dea7cafd4e4
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
bb10
parent
812bb236dd
commit
fefd9de52a
|
|
@ -686,9 +686,16 @@ void QWindowsPopupMenu::showPopup(const QWindow *parentWindow, const QRect &targ
|
|||
bool QWindowsPopupMenu::trackPopupMenu(HWND windowHandle, int x, int y)
|
||||
{
|
||||
lastShownPopupMenu = this;
|
||||
return TrackPopupMenu(menuHandle(),
|
||||
// Emulate Show()/Hide() signals. Could be implemented by catching the
|
||||
// WM_EXITMENULOOP, WM_ENTERMENULOOP messages; but they do not carry
|
||||
// information telling which menu was opened.
|
||||
emit aboutToShow();
|
||||
const bool result =
|
||||
TrackPopupMenu(menuHandle(),
|
||||
QGuiApplication::layoutDirection() == Qt::RightToLeft ? UINT(TPM_RIGHTALIGN) : UINT(0),
|
||||
x, y, 0, windowHandle, nullptr) == TRUE;
|
||||
emit aboutToHide();
|
||||
return result;
|
||||
}
|
||||
|
||||
bool QWindowsPopupMenu::notifyTriggered(uint id)
|
||||
|
|
|
|||
Loading…
Reference in New Issue