[Interest] How can I block the WindowActivate and FocusIn events when showing window programmatically

Yili Pan pyl0420 at gmail.com
Fri Oct 31 15:35:49 CET 2014


Hi Bo:

Thank you for the reply!

I do not want to filter out all the WindowActivate or FocusIn event tough,
only these are triggered by calling QWidget::show(). But because the events
are processed asynchronously in Qt5, when I catch them in the eventfilter,
I don't know whether they are originated from calling show() or they
are spontaneous
event caused by manual interaction. I also tried to filter out the event by
telling whether they are spontaneous, but unfortunately no matter where
they originate from, they are spontaneous (could this be a bug??). Any
thoughts or suggestion :)

Thank you!

-Yili

On Fri, Oct 31, 2014 at 4:01 AM, Bo Thorsen <bo at vikingsoft.eu> wrote:

> Den 30-10-2014 20:30, Yili Pan skrev:
> > Hi:
> >
> > We want to block the widget's WindowActivate and FocusIn event
> > triggered by calling its show() function, with Qt4,  we used to do
> > that by setting flag before and after show() and filter out the event
> > in eventfilter based on the flag.  But with Qt5, the events are
> > processed asynchronously, we cannot block the event in the same way
> > anymore.
> >
> > Any ideas how I can identify those events that are caused by calling
> > QWdiget::show() and filter them out?
>
> You can use an event filter for this. Take a look at the documentation
> for QObject::installEventFilter, it should be simple to follow.
>
> Bo.
>
> --
> Viking Software
> Qt and C++ developers for hire
> http://www.vikingsoft.eu
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20141031/69828e7a/attachment.html>


More information about the Interest mailing list