PDA

View Full Version : Qt 4.8 QApplication::macEventFilter



migel
21st April 2012, 16:58
Qt 4.8 finally supports macEventFilter when built with Cocoa and it finally gets called in my app.

But no idea hot to receive the event type from

NSEvent *e = reinterpret_cast<NSEvent *>(event);


application.cpp:28: error: 'NSEvent' was not declared in this scope

How to include libs needed for NSEvent to my qt c++ app ?

I am trying to get working clicking on mac Doc icon to show the window focused again when previously hided when pressed on X in the mainwindow.

Thanks

migel
24th April 2012, 20:25
anyone please ?

aftos
28th May 2012, 09:08
I have the same problem. I'm trying to handle the FileOpen event in order to open a file by double-clicking the file, but i don't receive the event. I've subclassed QApplication and tried to catch the event in the eventFilter and in the event. Nothing! All other events (mouse, keyboard etc) are ok. So, i'm now trying to catch it by using the macEventFilter but i can't compile. I get the same error:"'NSEvent' was not declared in this scope". Any help would be much appreciated.

ChrisW67
28th May 2012, 09:14
Your issue has nothing to do with libraries: they are compiler error messages. You have to #include the relevant headers so the compiler has a definition of NSEvent. I am sure the Apple developer documentation will tell you exactly, but if I had to guess (http://dictionary.reference.com/browse/guess) then:


#include <NSEvent.h>
or
#include <nsevent.h>

aftos
28th May 2012, 09:50
Thanx. I'll try the mac devel docs. By the way, can you tell me why i don't get the event FileOpen in the event/eventFilter function at mac? I'm asking this because i saw other topics about this and they say that this method (common event/eventFilter) works :confused:
Sorry for the off-topic.

ChrisW67
28th May 2012, 23:50
No, I am not a Mac developer.