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 Updated to NodeBB v4.3 + New Features

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 585 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 27 Feb 2024, 13:51 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;
    }
    
    J 1 Reply Last reply 27 Feb 2024, 14:21
    0
    • Q Qt embedded developer
      27 Feb 2024, 13:51

      @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;
      }
      
      J Offline
      J Offline
      JonB
      wrote on 27 Feb 2024, 14:21 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 27 Feb 2024, 19:23
      3
      • J JonB
        27 Feb 2024, 14:21

        @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 27 Feb 2024, 19:23 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.

        C 1 Reply Last reply 27 Feb 2024, 19:37
        0
        • Q Qt embedded developer
          27 Feb 2024, 19:23

          @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.

          C Online
          C Online
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on 27 Feb 2024, 19:37 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 28 Feb 2024, 07:00

          1/4

          27 Feb 2024, 13:51

          • Login

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