[Interest] About event filter on QApplication

程梁 devbean at outlook.com
Mon Nov 4 02:04:39 CET 2013

Thank you, Thiago!
Yeah, I know return true is not clever. This is a demo code in my Qt text. Someone commented me the differences between Qt4 and Qt5 if return true. I guess the same reason as  you mentioned in last mail. This might because the different processes between the two versions which the documents didn't point out. I just wonder if this is right or I missed some docs.
Thank you anyway!

Cheng Liang
Nanjing, China

From: thiago.macieira at intel.com
To: interest at qt-project.org
Date: Sun, 3 Nov 2013 08:28:16 -0800
Subject: Re: [Interest] About event filter on QApplication

On domingo, 3 de novembro de 2013 15:21:09, 程梁 wrote:
> As you could see, I installed a global event filter on QApplication. Note
> that I have returned true in the filter which means all events should stop
> processing. In Qt4, the output ("QApplication::eventFilter") will still
> there but with Qt5 nothing outputs. This might because watched and
> m_watched is not the same (QWidgetWindow). But when I changed to return
> false as default code, the output is there again. Maybe in Qt5 the return
> value also changes watched objects? I cannot find any documents about this.
> Could you help me? Thank you!
Returning true for all events is a stupid idea. You're blocking ALL events, 
including those that Qt needs working in order to make your functionality 
So my conclusion is that you blocked some event that was a precursor to the 
event sent to the label.
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

Interest mailing list
Interest at qt-project.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20131104/602bd8e7/attachment.html>

More information about the Interest mailing list