Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. RemoveEventFilter
Qt 6.11 is out! See what's new in the release blog

RemoveEventFilter

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 3.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    bu7ch3r
    wrote on last edited by
    #1

    Hello,

    I have a function where I change the EventFilter from an object to another. The problem is that I only know the new object and I cannot remove the event filter installed before. Take the below example.

    [code]
    void MyClass :: installNewFilter()
    {
    //I don't know what filter was before so I cannot delete...A removeAllFilters method should do

    myControl->installEventFilter(this);
    }
    [/code]

    Later edit: What if I call removeEventFilter(NULL) ?

    for(int i = 200; i > 0;)
    try
    {
    //do something
    }
    catch(...)
    {
    i--;//try again
    }

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on last edited by
      #2

      Unfortunately there is no public API to achieve this. You'll have to do the bookkeeping yourself, eg. by using specialized methods that add your filter to a list of filters.

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • B Offline
        B Offline
        bu7ch3r
        wrote on last edited by
        #3

        Thank you Volker, I have stored all parents into a list and removed them on a new install.

        for(int i = 200; i > 0;)
        try
        {
        //do something
        }
        catch(...)
        {
        i--;//try again
        }

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved