1

I am trying to get dock click event on dock icon on Mac OS X. I am using Qt-Cocoa. Any help would be highly appreciated.

Thanks, Rahul

RLT
  • 4,219
  • 4
  • 37
  • 91

3 Answers3

1

I've done this for an open-source project. See the code here: https://github.com/KDAB/Charm/blob/master/Charm/MacApplicationCore.mm

Dmitry Isaev
  • 3,888
  • 2
  • 37
  • 49
Mike McQuaid
  • 9,615
  • 6
  • 33
  • 38
  • You've got a broken link here .. if you aren't able to correct it (or add context to this answer beyond the link), this answer will need to be removed. – Tim Post Jul 21 '11 at 02:37
  • 1
    Ok, actually it's broken again... I think the file is now located at: https://github.com/KDAB/Charm/blob/master/Charm/MacApplicationCore.mm – u-foka Apr 17 '14 at 16:02
0

In Qt-Carbon, see Qt4 Mac Dock Icon Click. It explains how to install a reopen event handler.

In Qt-Cocoa, you should get the application delegate with [[NSApplication sharedApplicaion] delegate] and add you own applicationShouldHandleReopen:hasVisibleWindows: method with class_addMethod. I have not actually tried this.

0xced
  • 25,219
  • 10
  • 103
  • 255
  • This will not work with Qt-Cocoa. It will work only with Qt-Carbon. – RLT Sep 28 '10 at 14:16
  • Your links are broken. If you don't add context to this answer in their absence, this answer will be removed shortly. – Tim Post Jul 21 '11 at 02:38
0

On Qt 5.9.1 you can also use a hack without any platform-specific code at all. See https://stackoverflow.com/a/46488514/8695355

kmedv
  • 109
  • 2