Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-18624

[macOS] NSWorkspace Shutdown/Log off notifications doesn't work with Qt Cocoa applications

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.14.1
    • 4.7.0, 5.7.0, 5.12.0 Beta 4
    • QPA
    • macOS 10.6.7, Qt Cocoa 4.7.0, macOS 10.11 Qt 5.7
    • macOS
    • 35713ef3fffeb7476a8a72490caeffbda81c4f09 (qt/qtbase/wip/cmake)
    • Bug Fixing Week Q2/2020

    Description

      To track shutdown/log off event in a Qt Application.

      As Qt doesn't provide anything for track above events, NSWorkspace is used by registering notification for Shutdown/log out (NSWorkspaceWillPowerOffNotification). It is not working with Qt Cocoa application.
      Some other notifications like Sleep, Wake as NSWorkspaceWillSleepNotification, NSWorkspaceDidWakeNotification respectively are also registered and they are working fine with Qt

      To test notification registration code, same code to register with default notification center is used with simple Cocoa application (not using Qt) and it works fine as all notifications for sleep, wake, sleep/logout are received by user.

      Sample code has been attached as ShutDownTrackerQt.zip(notifications not received) and ShutDownTrackerCocoa.zip (notifications received)

      Attachments

        For Gerrit Dashboard: QTBUG-18624
        # Subject Branch Project Status CR V

        Activity

          People

            vestbo Tor Arne Vestbø
            jainishjain Jainish Jain
            Votes:
            2 Vote for this issue
            Watchers:
            9 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes