I am working on building a Mac OS X distribution of a Qt application. But there is an oddity that seems to be only affecting the Mac build, it is not present on Windows or Linux. Well, I assume Linux, I don't know if the author has specifically tested this or not.
I don't know a lot about Qt, so I'm glad there is a Newbie forum.
Anyway, the issue is that a QMenu is being used via its popup() method. Both the aboutToHide() signal for the menu and the triggered() signal for the actions are connected to slots.
The problem is that cleanup work is done in the aboutToHide() call. But this signal fires before the triggered() signal fires which causes problems. And at this point the activeAction() returns 0, so it looks like nothing was selected even if it was.
I can't think of a way to have something called to do cleanup but if and only if the menu was dismissed without selecting an action. I tried to think of a way in a QMenu subclass to capture this information so when the aboutToHide() signal fired I could decide what to do, but I had no luck there either... So either foregoing the signal aboutToHide() if a selection was made, or way to detect if an action was selected in the aboutToHide() called slot would be wonderful.
Oh, and the connection for aboutToHide() is of type Qt::QueuedConnection which the author thought was sufficient to ensure that the signal was not fired until triggered() was, and on Windows at least this problem does not exist.
Any thoughts?
Bookmarks