MnemosynedD
MnemosynedD

Reputation: 13

Application won't quit from dock icon, quits qt instead

I'm using Qt in an application's plugin. Since upgrading Qt from 4.3.4 to 4.6.4 carbon, Qt seems to want to take control of the application. To regain the menu, I have done

qApp->setAttribute(Qt::AA_MacPluginApplication,true);

However, when I try to close the application from the dock icon, Qt quits instead of the application.

How can that be corrected?

Additional infos: - Show/Hide from dock works as expected. - ⌘Q quits the native application (as expected) - Quit from the menu quits the native application (as expected) - Same problem with Qt 4.6.4 cocoa.

Upvotes: 0

Views: 635

Answers (1)

MnemosynedD
MnemosynedD

Reputation: 13

This is a Qt bug introduced in 4.6. https://bugreports.qt-project.org/browse/QTBUG-8087?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

Fortunately, there is workaround.

long refCon = 0;
AEEventHandlerUPP handler = NULL;
AEGetEventHandler(kCoreEventClass, kAEQuitApplication, &handler, &refCon, false);

QApplication::setAttribute(Qt::AA_MacPluginApplication, true);
int argc = 0;
(void)new QApplication(argc, 0, true);

if (handler)
{
    AEInstallEventHandler(kCoreEventClass, kAEQuitApplication, handler, refCon, false);
}

Upvotes: 0

Related Questions