PDA

View Full Version : Dynamic library with GUI for Mac



mouse_sonya
20th July 2010, 00:25
Hi All,

I successfully made dynamic library (Photoshop plug-in) on QT for Windows. I create one global QApplication and I use QWinWidget for passing parent Photoshop window to my QDialog. I open my QDialog with exec() method and everything works perfect.

But I have problems with my library on Mac.
My dialog can be opened in Photoshop but it changes main top menu. It looks like my dialog is a separate application. And Photoshop's menu is not recovered after closing the dialog and deleting QApplication.
Is there any way to pass native Mac window as a parent for QT QDialog like I do using QWinWidget in Windows?

My simplified code for Windows is

MACPASCAL void PluginMain(const short selector, FilterRecord *filterParamBlock, long *hwnd_parent, short *result)
{
int argc = 0;
QApplication *theQApp = new QApplication(argc, NULL);

PlatformData *platform = (PlatformData*)(fpb->platformData);
QWinWidget main_wnd((HWND)hwnd_parent);

CPhFToolDlg *dlg = new CPhFToolDlg(data, &main_wnd, Qt::WindowCloseButtonHint);
dlg->exec();

delete dlg;
delete theQApp;
}

And for Mac is the same but without using parent window:
MACPASCAL void PluginMain(const short selector, FilterRecord *filterParamBlock, long *hwnd_parent, short *result)
{
int argc = 0;
QApplication *theQApp = new QApplication(argc, NULL);
CPhFToolDlg *dlg = new CPhFToolDlg(data, NULL, Qt::WindowCloseButtonHint);
dlg->exec();

delete dlg;
delete theQApp;
}

I have a problem on Mac even without a GUI.
Simple creation and deleting of QApplication make "Quit Photoshop" item of main Photoshop menu not work. Photoshop launches my PluginMain function, and all main menu items work properly but Photoshop stays open after "Quit" item for some reason.
MACPASCAL void PluginMain(const short selector, FilterRecord *filterParamBlock, long *hwnd_parent, short *result)
{
int argc = 0;
QApplication *theQApp = new QApplication(argc, NULL);
delete theQApp;
}

Does anybody have an experience in dynamic library creation for Mac? Can you point me some examples? Your help will be very appreciated.

Thank you,
Sofia

mouse_sonya
26th July 2010, 13:23
I've found description of my problem on http://bugreports.qt.nokia.com/browse/QTBUG-8087