Dynamic library with GUI for Mac



  • 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



  • Could you wrap your code in "@" signs please? That makes it a lot easier to read. Thanks!



  • Have you tried to use QMacNativeWidget in the same way like the QWinWidget ?



  • I've solved my problems.
    I've found Qt::AA_MacPluginApplication application attribute for main top menu not to be replaced.

    And I've found "Quit" problem description in http://bugreports.qt.nokia.com/browse/QTBUG-8087.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.