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. How installEventFilter and eventFilter works ? why when return true in event filter not load qml ?
Forum Update on Monday, May 27th 2025

How installEventFilter and eventFilter works ? why when return true in event filter not load qml ?

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 3 Posters 569 Views
  • 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.
  • Q Offline
    Q Offline
    Qt embedded developer
    wrote on last edited by
    #1

    @Qt-embedded-developer

    I want to know why qml not get loaded due to below type of implementation.

    calling the below line into class constructor :

    pPtr->installEventFilter(this);
    

    And i have written the below function def:

    bool Bapplication::eventFilter(QObject *watched, QEvent *event)
    {
    
    return true;
    }
    
    JonBJ 1 Reply Last reply
    0
    • Q Qt embedded developer

      @Qt-embedded-developer

      I want to know why qml not get loaded due to below type of implementation.

      calling the below line into class constructor :

      pPtr->installEventFilter(this);
      

      And i have written the below function def:

      bool Bapplication::eventFilter(QObject *watched, QEvent *event)
      {
      
      return true;
      }
      
      JonBJ Online
      JonBJ Online
      JonB
      wrote on last edited by
      #2

      @Qt-embedded-developer
      Although I know nothing about QML, if eventFilter() always returns true then no events are passed are passed to any object. You need to return false (at least sometimes) to let the application see any events, at present it does not. I imagine that stops QML working/loading?

      Q 1 Reply Last reply
      3
      • JonBJ JonB

        @Qt-embedded-developer
        Although I know nothing about QML, if eventFilter() always returns true then no events are passed are passed to any object. You need to return false (at least sometimes) to let the application see any events, at present it does not. I imagine that stops QML working/loading?

        Q Offline
        Q Offline
        Qt embedded developer
        wrote on last edited by Qt embedded developer
        #3

        @JonB Yes this happening. So it's quite difficult to debug this type of code.

        1. Can you give reference to avoid this type of problem in code.

        2. i also want to understand that why when pass true at that time it not allow to load qml ? If any reference link is there it will helpful.

        3. I also want to know when this type of scenario come to not allow loading of qml. any real time example.

        Christian EhrlicherC 1 Reply Last reply
        0
        • Q Qt embedded developer

          @JonB Yes this happening. So it's quite difficult to debug this type of code.

          1. Can you give reference to avoid this type of problem in code.

          2. i also want to understand that why when pass true at that time it not allow to load qml ? If any reference link is there it will helpful.

          3. I also want to know when this type of scenario come to not allow loading of qml. any real time example.

          Christian EhrlicherC Online
          Christian EhrlicherC Online
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Qt-embedded-developer I really wonder what's so hard looking into the documentation ... esp. since you would get an answer much earlier.
          RTM: https://doc.qt.io/qt-6/eventsandfilters.html#event-filters

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          1 Reply Last reply
          0
          • Q Qt embedded developer 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