Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Which header/framework to add to get EventRef type for QT 5.3
Forum Updated to NodeBB v4.3 + New Features

Which header/framework to add to get EventRef type for QT 5.3

Scheduled Pinned Locked Moved General and Desktop
4 Posts 4 Posters 1.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mavericks
    wrote on last edited by
    #1

    Current we are including Carbon.h to get access to the EventRef type so that we can convert it to NSEvents as shown below

    @#include "Carbon/Carbon.h"

    nativeEvent(const QByteArray& eventType, void* message,long* result)
    {
    EventRef event = reinterpret_cast<EventRef>(message);
    NSAutoreleasePool *poolP = [[NSAutoreleasePool alloc] init];
    NSEvent *eventP = [NSEvent eventWithEventRef: event];
    ...
    ...
    }
    @

    Is the above code doing correct conversions for EventRef, also is it the right thing to do to include Carbon.h header for the same ?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Qt 5 implements only Cocoa, so you can cast directly to NSEvent

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • crystalideaC Offline
        crystalideaC Offline
        crystalidea
        wrote on last edited by
        #3

        The doc says:
        "On Mac, eventType is set to "mac_generic_NSEvent", and the message can be casted to an EventRef."
        so the header is
        #include <Carbon/Carbon.h>

        1 Reply Last reply
        0
        • C Offline
          C Offline
          Cits
          wrote on last edited by
          #4

          This is the include needed:
          #include <AppKit/NSEvent.h>

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved