• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Integrating Qt into a filter plugin

Explorer ,
Apr 19, 2011 Apr 19, 2011

Copy link to clipboard

Copied

Hello,

I've been developing a filter plugin that requires a pretty hefty UI. I've chosen to use Qt for this because I am deploying to both mac and windows, however, it's been a little nightmarish getting all the details just right.  Things like windows staying on top etc has been problematic and very different on each platform,  I've also run into problems of being unable to use certain features of Qt like meta-types because the declaration/allocation/whatever seems to linger between runs of the filter and cause 'open twice' crashes, with all sorts of namespace smashing errors/warning sprinkled in here and there.  I've also accidently hi-jacked photoshop's menu bar (Mac OSX) causing you to be unable to quit photoshop after running my plugin.  Some 'solutions' have been put in place by myself and my co-workers but they are quite frankly a little sketchy/incomplete for my taste.

Does anyone know any resources (or examples) that illustrate a sane Qt/Photoshop API integration?

TOPICS
SDK

Views

4.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
New Here ,
Sep 28, 2013 Sep 28, 2013

Copy link to clipboard

Copied

Did you ever find any good documentation?  I would be very interested in the links if you did.

-Tim

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 30, 2013 Sep 30, 2013

Copy link to clipboard

Copied

Don't do it. At least on Mac there are collisions between the various Cocoa event loops and globals. We had no end of problems until we split our UI out into its own application. Makes it a lot easier to test too.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 30, 2013 Sep 30, 2013

Copy link to clipboard

Copied

Thanks for the heads up.  So when you say you split your UI to it's own application are you using QT for that and then making calls back to photoshop? 

-Tim

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 30, 2013 Sep 30, 2013

Copy link to clipboard

Copied

Yeah the external application is built entirely with Qt. Use whatever IPC you like to shlep image data around (I found simply saving the PS image to a temp file works well enough).

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Sep 30, 2013 Sep 30, 2013

Copy link to clipboard

Copied

Indeed there is not much documentation around about it. It's more straightforward on PC using QWinWidget; on Mac you indeed have to do some extra legwork which is pretty hacky. In the end however it works great - we've been using Qt in PS plugins for many years and while the Cocoa port was somewhat of a challenge,it did eventually work, so there is no reason to give up on it.

We were considering publishing a sample stand-alone Qt plugin at some point, but with layers and layers of common libraries and platform-independed abstractions it's a lot of hassle to isolate only the code required, so we've never got around to it.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 10, 2013 Oct 10, 2013

Copy link to clipboard

Copied

I am not sure how deeply you have investigated your problems but I did port a few PS plugins from Windows to Mac using QT 4.8 and 5.1.1 on both platforms and I saw no problems that are unsolvable. I am building them with my own compiled QT (from sources) all in Xcode 4.6.2 and with OpenMP (now making that work was difficult comparing to QT) and both run absolutely fine. The amount of platform specific ifdefs is minimal (Mac requires special window setting to tell QT its a plugin) and a few others to make UI layout work a bit more predictably but that's about it.

This is one of them for example (page translated to English but plugin language interface is English by default):

http://translate.google.co.uk/translate?hl=en&sl=ru&u=http://www.uni-vologda.ac.ru/~c3c/plug-ins/col...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 10, 2013 Oct 10, 2013

Copy link to clipboard

Copied

Things must have gotten better then! I was doing this back in the 4.2 and 4.3 time period, also during the big Carbon->Cocoa transition. Once Cocoa came about we started having problems with the Objective C bindings randomly "preferring" code from another vendor's Qt-based plugin, which of course used a different version of Qt. We never could figure out a workaround for this one.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 10, 2013 Oct 10, 2013

Copy link to clipboard

Copied

Not really sure how that is possible - plugin using QT is bound to a specific version of the QT framework or (as in my case) compiled with QT statically (this avoids multitude of the framework packaging problems).

I was only responding since the replies to the thread seem to be very recent so surely they were about recent versions of QT, PS SDK and Xcode.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Oct 10, 2013 Oct 10, 2013

Copy link to clipboard

Copied

fxtech: to deal with this sort of problems we compile Qt with -qtnamespace [OutPrivateNameSpace] -qtlibinfix [_OutPrivateInfix] options - this guarantees no collision with other plugins' QT distros.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 10, 2013 Oct 10, 2013

Copy link to clipboard

Copied

Example plugin execution pattern from filter plugin entry point (for both Mac and Windows):

#if defined( Q_OS_MACX )

    QCoreApplication::setAttribute(Qt::AA_MacPluginApplication, true);

    QCoreApplication::setAttribute(Qt::AA_DontUseNativeMenuBar, true);

#endif

   QApplication app(argc, argv);

   QCoreApplication::setOrganizationName(MY_ORGANIZATION);

   QCoreApplication::setApplicationName(MY_APPLICATION);

#if defined( Q_OS_MACX )

    MainWindow mainWin(0);

    mainWin.setWindowFlags(Qt::Window | Qt::WindowTitleHint

                                      | Qt::CustomizeWindowHint

                                      | Qt::WindowCloseButtonHint);

#else

    PlatformData* platform = (PlatformData*)filterRecord->platformData;

    QWinWidget win((HWND)platform->hwnd);

    MainWindow mainWin(&win);

    mainWin.setWindowFlags(Qt::Window | Qt::WindowTitleHint

                                      | Qt::CustomizeWindowHint

                                      | Qt::WindowCloseButtonHint);

#endif

    mainWin.show();

    resultCode = app.exec();

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 10, 2013 Oct 10, 2013

Copy link to clipboard

Copied

The Mac version of the plugin I referred to above -  http://wowcamera.info/gallery/image.php?album_id=23&image_id=6388&view=no_count

(for comparison - they are pretty similar and based on exactly teh same code and UI form and behave the same).

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 29, 2016 Oct 29, 2016

Copy link to clipboard

Copied

Alexey Danilchenko​, How did you manage to make OpenMP work?

I have issues with it on OS X (On Windows it works for some reason).

Thank You.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 14, 2017 Jan 14, 2017

Copy link to clipboard

Copied

LATEST

I installed  my own version of LLVM (from LLVM.org) and converted it into toolchain for Xcode. Then it is as simple as selecting it in Xcode and adding OpenMP definitions and flags

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines