Results 1 to 6 of 6

Thread: Qt 4.8 QApplication::macEventFilter

  1. #1
    Join Date
    Apr 2011
    Posts
    132
    Thanks
    14
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Qt 4.8 QApplication::macEventFilter

    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
    Qt Code:
    1. NSEvent *e = reinterpret_cast<NSEvent *>(event);
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. application.cpp:28: error: 'NSEvent' was not declared in this scope
    To copy to clipboard, switch view to plain text mode 

    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

  2. #2
    Join Date
    Apr 2011
    Posts
    132
    Thanks
    14
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Qt 4.8 QApplication::macEventFilter

    anyone please ?

  3. #3
    Join Date
    May 2012
    Posts
    13
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qt 4.8 QApplication::macEventFilter

    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.

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Qt 4.8 QApplication::macEventFilter

    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 then:
    Qt Code:
    1. #include <NSEvent.h>
    2. or
    3. #include <nsevent.h>
    To copy to clipboard, switch view to plain text mode 

  5. #5
    Join Date
    May 2012
    Posts
    13
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qt 4.8 QApplication::macEventFilter

    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
    Sorry for the off-topic.
    Last edited by aftos; 28th May 2012 at 09:54.

  6. #6
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Qt 4.8 QApplication::macEventFilter

    No, I am not a Mac developer.

Similar Threads

  1. Replies: 2
    Last Post: 1st August 2011, 06:30
  2. Qt without QApplication
    By jakebman in forum Newbie
    Replies: 6
    Last Post: 25th July 2008, 00:38
  3. regarding QApplication::focusWidget ()
    By sar_van81 in forum Qt Programming
    Replies: 5
    Last Post: 21st December 2006, 10:00
  4. why we have need of QApplication
    By Krishnacins in forum Qt Programming
    Replies: 11
    Last Post: 12th April 2006, 16:37
  5. <QtGui/QApplication> vs. <QApplication>
    By seneca in forum Qt Programming
    Replies: 5
    Last Post: 25th January 2006, 10:58

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.