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. After addWidget, eventFilter suddenly doesn't work.
Forum Updated to NodeBB v4.3 + New Features

After addWidget, eventFilter suddenly doesn't work.

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 357 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.
  • J Offline
    J Offline
    John Van
    wrote on last edited by John Van
    #1
    This post is deleted!
    Pl45m4P 1 Reply Last reply
    0
    • J John Van

      @Pl45m4
      This line is only for testing catch events. I originally wanted to catch a specific event, but it always failed.

      EventFilter cannot catch any kind of events.

      Pl45m4P Offline
      Pl45m4P Offline
      Pl45m4
      wrote on last edited by Pl45m4
      #4

      @John-Van

      So what events you want to filter?

      If I'm not mistaken an event filter jumps in right before the object's QObject::event(QEvent *ev) function is called...
      So you can handle any QEvent there as well


      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

      ~E. W. Dijkstra

      1 Reply Last reply
      0
      • J John Van

        This post is deleted!

        Pl45m4P Offline
        Pl45m4P Offline
        Pl45m4
        wrote on last edited by
        #2

        @John-Van said in After addWidget, eventFilter suddenly doesn't work.:

        this->installEventFilter(this);
        

        What's the purpose for this line?
        You usually don't set an event filter for yourself, since the widget gets all the events anyway and you could handle them in their native event handler.

        m_widget = new DWidget(this);
        ui.vLayout->addWidget(m_widget);
        this->installEventFilter(this);
        

        The eventFilter doesn't working,eventFilter cannot intercept any events.

        What kind of events? I suspect other widgets to take the events before your filter receives them.


        If debugging is the process of removing software bugs, then programming must be the process of putting them in.

        ~E. W. Dijkstra

        J 1 Reply Last reply
        1
        • Pl45m4P Pl45m4

          @John-Van said in After addWidget, eventFilter suddenly doesn't work.:

          this->installEventFilter(this);
          

          What's the purpose for this line?
          You usually don't set an event filter for yourself, since the widget gets all the events anyway and you could handle them in their native event handler.

          m_widget = new DWidget(this);
          ui.vLayout->addWidget(m_widget);
          this->installEventFilter(this);
          

          The eventFilter doesn't working,eventFilter cannot intercept any events.

          What kind of events? I suspect other widgets to take the events before your filter receives them.

          J Offline
          J Offline
          John Van
          wrote on last edited by John Van
          #3

          @Pl45m4
          This line is only for testing catch events. I originally wanted to catch a specific event, but it always failed.

          EventFilter cannot catch any kind of events.

          Pl45m4P 1 Reply Last reply
          0
          • J John Van

            @Pl45m4
            This line is only for testing catch events. I originally wanted to catch a specific event, but it always failed.

            EventFilter cannot catch any kind of events.

            Pl45m4P Offline
            Pl45m4P Offline
            Pl45m4
            wrote on last edited by Pl45m4
            #4

            @John-Van

            So what events you want to filter?

            If I'm not mistaken an event filter jumps in right before the object's QObject::event(QEvent *ev) function is called...
            So you can handle any QEvent there as well


            If debugging is the process of removing software bugs, then programming must be the process of putting them in.

            ~E. W. Dijkstra

            1 Reply Last reply
            0
            • J John Van has marked this topic as solved on

            • Login

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