代码:
bool tray::nativeEventFilter(const QByteArray &eventType, void *message, long *)
{
qDebug("tray::nativeEventFilter:%s\n", eventType.data());
if (eventType == "xcb_generic_event_t") {
xcb_generic_event_t* ev = static_cast<xcb_generic_event_t *>(message);
// ...
}
return false;
}
问题标签页:/home/test/Downloads/tray/tray/tray.cpp:244: error: unknown type name 'xcb_generic_event_t'
输出窗口:
../tray/tray.cpp:244:9: error: ‘xcb_generic_event_t’ was not declared in this scope
xcb_generic_event_t* ev = static_cast<xcb_generic_event_t *>(message);
^~~~~~~~~~~~~~~~~~~
../tray/tray.cpp:244:9: note: suggested alternative: ‘xGenericEvent’
xcb_generic_event_t* ev = static_cast<xcb_generic_event_t *>(message);
^~~~~~~~~~~~~~~~~~~
xGenericEvent
解决:#include <xcb/xcb.h>