PDA

View Full Version : Auto-hiding of QWidgets when faking mouseevent



kinglui987
26th May 2013, 22:11
Hey there,

currently i am developing an application in which i have to fake QMouseEvent and post
them using QApplication::postEvent into the eventloop of Qt. Everything works fine,except
that already activated QWidget (eg. QMenubars) are not automatically hided, when they are opened.

My application has a QMenuBar with 4 QMenus, each of them with several MenuItems. The QMenus are drop-down lists.

The usual behavior is like this: When a QMenu is opened and one clicks with the mouse on an area not covered by the QMenu,
the QMenu gets auto hided. This is the behavior one is used to and also expected.

The problem with my fake QMouseEvent is, when a QMenu is opened and i am faking a QMouseEvent,
the QMenu does not get auto hided and keeps being opened.

Anyone an idea, why it is like this?

Note: I can see that my fake QMouseEvent is processed by the QWidget under the cursor position, i gave my fake QMouseEvent.

wysota
27th May 2013, 07:48
Let's start from the beginning -- why do you need to fake mouse events?