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. Help with QAbstractNativeEventFilter

Help with QAbstractNativeEventFilter

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 6.6k 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.
  • A Offline
    A Offline
    alee
    wrote on last edited by
    #1

    i need to recieve windows native events in a MYCLASS that is instantiated in a QWidget..... i am deriving MYCLASS from QAbstractNativeEventFilter and overriding the virtual nativeEventFIlter . and that is as far as i get.....the program compiles but no native events are received

    it says in the documentation that i need to install the filter on the application object using the constructor....but there seems to be no constructor for this abstract class.....the documentation is quite minimal, could someone please explain the correct method of using this abstract class...

    thanks

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

      Hi
      Within your main window class declare the following (or similar)
      @
      class MyNativeEventFilter: public QAbstractNativeEventFilter
      {
      public:
      virtual bool nativeEventFilter(const QByteArray &eventType, void message, long )
      Q_DECL_OVERRIDE
      {
      MSG
      msg = (MSG
      )(message);
      if(msg->message == WM_SYSCOMMAND &&
      (0xfff0 & msg->wParam) == SC_CONTEXTHELP) {
      QWhatsThis::enterWhatsThisMode();
      }
      return false;
      }
      };
      @
      Then in the constructor of the main window class install the event filter -
      @
      QApplication::instance()->installNativeEventFilter(new MyNativeEventFilter());
      @

      HTH

      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