PDA

View Full Version : how to get MouseClick Event in this case



yxmaomao
16th July 2008, 09:32
I have a QMainWindow which has some child controls (eg. QTableView).
Now I want to QMainWindow get all mouse click event. How to do this?

I am using Qt4.3 with XP
I have tried eventFilter() in QMainWindow, but problem is when you click on the QTableView(actually any kind of child control)
,progrom can't enter the QMainWindow's eventFilter().

Can anybody help me?

caduel
16th July 2008, 09:52
various possibilites:
* you can use eventFilter() (don't forget to install it on all the watched widgets!)
* you should read QCoreApplication::notify()


other question: why do you want that?

HTH

yxmaomao
17th July 2008, 00:34
that is my special case:
there is a button, click this button will popup a frameless widget, then when you click any other position in my main window will make this widget disappear. so In my main window I want to get mouse click event even if you click main window's child control.

yxmaomao
17th July 2008, 03:03
I have done this as below:

just using QCoreApplication::notify(), thanks caduel!