Originally Posted by
shokarta
but it just gives me thre errors while compile:
C:\Qt\Projects\Sources\Inventory\main.cpp:-1: error: error: undefined reference to 'vtable for MyAppNativeEventFilter'
:-1: error: the vtable symbol may be undefined because the class is missing its key function
:-1: error: linker command failed with exit code 1 (use -v to see invocation)
C:\Qt\Projects\Sources\Inventory\main.cpp:-1: error: error: undefined reference to 'vtable for MyAppNativeEventFilter'
:-1: error: the vtable symbol may be undefined because the class is missing its key function
:-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:
// Declare
class MyAppNativeEventFilter : public QAbstractNativeEventFilter
{
virtual bool nativeEventFilter
(const QByteArray &eventType,
void *message,
long *result
) override
};
// Implement
bool MyAppNativeEventFilter
::nativeEventFilter(const QByteArray &eventType,
void *message,
long *result
) override
{
return false;
}
// Declare
class MyAppNativeEventFilter : public QAbstractNativeEventFilter
{
virtual bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) override
};
// Implement
bool MyAppNativeEventFilter::nativeEventFilter(const QByteArray &eventType, void *message, long *result) override
{
return false;
}
To copy to clipboard, switch view to plain text mode
Bookmarks