Quote Originally Posted by shokarta View Post
but it just gives me thre errors while compile:
Qt Code:
  1. C:\Qt\Projects\Sources\Inventory\main.cpp:-1: error: error: undefined reference to 'vtable for MyAppNativeEventFilter'
  2. :-1: error: the vtable symbol may be undefined because the class is missing its key function
  3. :-1: error: linker command failed with exit code 1 (use -v to see invocation)
To copy to clipboard, switch view to plain text mode 
Your code declares the existence MyAppNativeEventFilter and its nativeEventFilter() function but does not provide an implementation. The abstract class requires an implementation of the nativeEventFilter() function. A minimal implementation could just return false; something like:
Qt Code:
  1. // Declare
  2. class MyAppNativeEventFilter : public QAbstractNativeEventFilter
  3. {
  4. virtual bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) override
  5. };
  6.  
  7. // Implement
  8. bool MyAppNativeEventFilter::nativeEventFilter(const QByteArray &eventType, void *message, long *result) override
  9. {
  10. return false;
  11. }
To copy to clipboard, switch view to plain text mode