[Interest] win: can't trap WM_ENTER/EXITMENULOOP?

Adam Light aclight at gmail.com
Mon Oct 25 23:23:55 CEST 2021


On Mon, Oct 25, 2021 at 9:40 AM David M. Cotter <dave at kjams.com> wrote:

> in the documentation here
> <https://docs.microsoft.com/en-us/windows/win32/menurc/menus>, it
> indicates i can get a message when the menu bar starts to be browsed, and
> another when the browsing is completed.
>
> this is *exactly* what i need (the purpose is unrelated to this post).
>
> So in my QMainWindow derived class, i override the nativeEvent() method,
> like so:
>
> [...]
>
> However, those messages are never sent :(
>
> Any idea why not?
>
I'm just guessing here, but it might be that the menu bar's events don't
get delivered to the QMainWindow.

Or, perhaps this documented caveat is important: "Note: Events are only
delivered to this event handler if the widget has a native window handle."

You might be able to catch the events if you
use QCoreApplication::installNativeEventFilter (
https://doc.qt.io/qt-6/qcoreapplication.html#installNativeEventFilter).

Adam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20211025/02fcb596/attachment.html>


More information about the Interest mailing list