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. QApplication and NSApplication

QApplication and NSApplication

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 385 Views
  • 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
    MrZnuk
    wrote on last edited by
    #1

    Hi,
    Is the QApplication implementation on macOS derive from or rely on the NSApplication class from AppKit?
    And more specifialy, is the NSApplicationMain is called when calling QApplication::exec?
    Thanks a lot for your help :)

    1 Reply Last reply
    0
    • I Online
      I Online
      IgKh
      wrote on last edited by IgKh
      #2

      Welcome to the forum.

      QApplication doesn't derive from NSApplication (even if it made sense, it can't - C++ classes can't inherit from Objective-C classes).

      Qt is cross platform, and to achieve that it has an internal layer called QPA (Qt Platform Abstraction) that isolates the native windowing APIs behind a plugin interface.

      On macOS, there is a Cocoa / AppKit based QPA plugin in use, which manages the global NSApplication behind the scenes, and links its event loop to Qt event handling. It does so by (among other things) attaching its own application delegate.

      QApplication::exec usually indirectly causes the run message to be dispatched to NSApp. NSApplicationMain is bypassed as it is irrelevant - Qt applications are by definition nibless. You shouldn't call it yourself.

      Hopefully this answers the question.

      1 Reply Last reply
      3
      • M Offline
        M Offline
        MrZnuk
        wrote on last edited by MrZnuk
        #3

        Hi @IgKh,
        Thanks a lot for this comprehensive response, this is much clearer now.
        Regards

        1 Reply Last reply
        0
        • M MrZnuk has marked this topic as solved on

        • Login

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