<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Ah yes, good point. That sounds much cleaner, thanks!<br>
    <br>
    Cheers,<br>
    frank<br>
    <br>
    <div class="moz-cite-prefix">On 22/07/18 2:59 AM, David Anes wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CA+o-tGMB5LZ5nfchF9VkjRfn-BJycRsvRoicdpKjisr2qt8YdQ@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=utf-8">
      <div dir="ltr">
        <div>Hi Frank,</div>
        <div><br>
        </div>
        <div>I would track the window object on my own on every call to
          the event filter, and if it's different, then do the
          removeEventFilter from the old one, installEvent on the new
          one and update the tracked object.</div>
        <div><br>
        </div>
        <div>Cheers,</div>
        <div>David.<br>
        </div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">2018-07-21 7:09 GMT+02:00 Frank Rueter
          | OHUfx <span dir="ltr"><<a href="mailto:frank@ohufx.com"
              target="_blank" moz-do-not-send="true">frank@ohufx.com</a>></span>:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
            <br>
            I have an interesting scenario where I need to install an
            event filter on the fly from inside another event filter.<br>
            <br>
            This is because the widget I install the first event filter
            on changes it's window() inside the main application under
            certain circumstances (out of my control), and I need to
            know about the widget.window()'s move event in order for the
            main event filter to work properly.<br>
            <br>
            Anyway, to avoid installing the same filter multiple times I
            currently do this inside the first event filter:<br>
                def eventFilter(self, obj, event):<br>
                    if event.type() == QtCore.QEvent.UpdateRequest:<br>
                        # obj.window() may or may not have change at
            this stage<br>
                        obj.window().removeEventFilter<wbr>(self.window_ef)<br>
                        obj.window().installEventFilte<wbr>r(self.window_ef)<br>
            <br>
            Is there a better way? I.e. is there a way to check which
            event filters are already installed?<br>
            <br>
            Cheers,<br>
            frank<br>
            <br>
            ______________________________<wbr>_________________<br>
            PySide mailing list<br>
            <a href="mailto:PySide@qt-project.org" target="_blank"
              moz-do-not-send="true">PySide@qt-project.org</a><br>
            <a
              href="http://lists.qt-project.org/mailman/listinfo/pyside"
              rel="noreferrer" target="_blank" moz-do-not-send="true">http://lists.qt-project.org/ma<wbr>ilman/listinfo/pyside</a><br>
          </blockquote>
        </div>
        <br>
        <br clear="all">
        <br>
        -- <br>
        <div class="gmail_signature" data-smartmail="gmail_signature">
          <div dir="ltr">
            <div>
              <div dir="ltr">David "kraptor" Anes Alcolea<br>
                * <a href="http://twitter.com/kraptor" target="_blank"
                  moz-do-not-send="true">@kraptor</a>
                <div>* <a href="http://linkedin.com/in/davidanes"
                    target="_blank" moz-do-not-send="true">linkedin.com/in/davidanes</a><br>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>