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

Scott Bloom scott at towel42.com
Mon Oct 25 21:49:47 CEST 2021


You are mixing and confusing windows native Win32 messages with Qt signals.
am I?

the doc here for "nativeEvent()"<https://doc.qt.io/qt-5/qwidget.html#nativeEvent> specifically states that this is intended to give you windows messages (WM_*) (on windows)

to wit:
"receive native platform events identified by eventType"

Platform:                             Event Type Identifier:                     Message Type:
Windows                             "windows_generic_MSG"            MSG *

note that i'm getting all kinds of OTHER "WM_" messages there, just not the ones i'm interested in.
Maybe “confusing” was too strong a word, but mixing is definitely true 😉 that combined with the incorrect assumption that Qt uses native widgets for menu’s is the root of the problem.


You are making the incorrect assumption that the Qt core internals are based on Windows native widgets.
yes well, that's true. my understanding is that Qt uses native widgets whenever possible. seemed to me that Menus would be a prime candidate for that


That is your mistake.
okay, so what you're saying is that, you know for a fact that the menu bar in a windows app built by Qt does not use native windows APIs for that? is that definitely true?
Yes, QMenu are just “custom drawn widgets” not native widgets.


Instead look into QMenu::aboutToShow and QWidget::closeEvent
does that work for the ENTIRE menu bar browsing workflow?

ie: get a "start" message when the user clicks the first time in the menu bar, and the user can then browse through all available menus if they like, and when they're done, whether they click OFF the menu bar (choosing no menu item) or if they do happen to pick a menu item, then i get one "finished" event message?

cuz that's what i need.
Not quite sure what you need, but you will get a signal before the menu is shown.  As well as aboutToHide (forgot that one), as well as when the menu actually closes QWidget::closeEvent.

You can also setup slots on the individual QActions that are added to the menu.



Your solution (if it worked) would only work on Windows
that's all i care about. no other platform necessary.
But all of Qt, is based on multi-platform support
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20211025/cc269ec6/attachment-0001.html>


More information about the Interest mailing list