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

Qt sample

Explorer ,
May 11, 2012 May 11, 2012

Copy link to clipboard

Copied

Hi

I'm developing a plugin for AI CS5 and AI CS6 for Windows and MacOSX.

I use Qt instead of ADM which is now not supported.

I'm trying to use Qt 4.8.1 on Windows 7 with Illustrator CS 5. When I quit Illustrator, the application crashes. If I remove the instanciation of the QApplication, Illustrator closes properly.

Is it possible to share some small example which runs on Windows and MacOS X ?

TOPICS
SDK

Views

3.6K

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
Explorer ,
May 14, 2012 May 14, 2012

Copy link to clipboard

Copied

I'll put a simple Qt dialog example together, I had one I posted to the developer prerelease, just have to update it a bit. Qt in a panel really doesn't work properly, so I can't show that, but in a dialog is quite straightforward.

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 ,
May 14, 2012 May 14, 2012

Copy link to clipboard

Copied

I've tested on MacOS X to use Qt in a panel and indeed it doesn't work well.

When I use Qt to make dialog boxes on MacOS X, it works properly but there seem less integrated for the final user. (We lose some default behaviours provided by the panel).

Is it possible to have a look on the example you posted in the developer prerelase ? Where will be the updated example, in a new SDK release or by a download link in this forum ?

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 ,
May 15, 2012 May 15, 2012

Copy link to clipboard

Copied

Can you post the crash log? Does it crash on both platforms?

The sample I had was to help others set up the project to include Qt, the actual Qt code was just to show a dialog. The hardest part for most people seems to be the qt project setup. If you have Qt set up in your project, you are way farther along than most.

The Qt code itself was showing Qt at it's most basic, modifying TwirlFilter example by pasting this at the top of

TwirlGetParms() function:

   

if (!QCoreApplication::instance()) {

            QApplication::setAttribute(Qt::AA_MacPluginApplication);

int argc = 0;

/*somePointerToDeleteLater = */ new QApplication(argc, 0); // normally, one would track that they did or did not allocate the qapp and delete it accordingly.

}

       

QWidget* parent = 0; // on mac a null parent works best

#ifndef MAC_ENV

AIWindowRef  windowRefParent;

AIErr  error = sAppContext->GetPlatformAppWindow(&windowRefParent);

assert(windowRefParent);

QWinWidget winParent(windowRefParent); // on pc, the app window wrapped in a qwinwidget works best

parent = &winParent;          

#endif

QString text = QInputDialog::getText(parent, "Tester", "Something:");

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 ,
May 16, 2012 May 16, 2012

Copy link to clipboard

Copied

I used the example named Tutorial. In the tutorial.cpp, I've declared the following variables

static bool g_ownApplication = false;

static QApplication* g_application = 0;

static int g_argc = 0; /

and I've put the following code in the StartupPlugin function.  The following code is executed only once

if (!g_application){

     g_ownApplication = (QCoreApplication::instance() == 0); // To know if we own the object, if yes we must delete it when AI closes

     if (g_ownApplication)

          g_application = new QApplication(g_argc, 0);

     else

          g_application = qobject_cast<QApplication*>(QCoreApplication::instance());

}

If I delete or not the QApplication object, AI crashes, it crashes in the DispatchHookW function.

When you tested Qt, which version did you use ?

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 ,
May 16, 2012 May 16, 2012

Copy link to clipboard

Copied

Can you post the stack trace? At what point during execution does it crash (i.e. startup/shutdown/after you show a dialog/after new doc)? We are using Qt 4.7.4, perhaps 4.8.x is the problem.

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 ,
May 21, 2012 May 21, 2012

Copy link to clipboard

Copied

I don't know if it will help you, I have something like this when AI closes

ntdll.dll!_ZwRaiseException@12()  + 0x12 octets
ntdll.dll!_ZwRaiseException@12()  + 0x12 octets
ntdll.dll!ExecuteHandler2@20()  + 0x26 octets
ntdll.dll!ExecuteHandler@20()  + 0x24 octets
ntdll.dll!_RtlDispatchException@8()  + 0xd3 octets
ntdll.dll!_KiUserExceptionDispatcher@8()  + 0xf octets
5bbb56c0()
user32.dll!_DispatchHookW@16()  + 0x38 octets
0018fd00()
ntdll.dll!_KiUserCallbackDispatcher@12()  + 0x2e octets
user32.dll!_NtUserGetMessage@16()  + 0x15 octets
user32.dll!_GetMessageW@16()  + 0x2b octets
Illustrator.exe!004c4dd1()
[Les frames ci-dessous sont peut-être incorrects et/ou manquants, aucun symbole chargé pour Illustrator.exe]
Illustrator.exe!004fa3df()
Illustrator.exe!0054da2a()
Illustrator.exe!005bf4dd()
>msvcr90.dll!_getptd_noexit()  Ligne 616 + 0x7 octetsC
Illustrator.exe!00c27b2c()
kernel32.dll!@BaseThreadInitThunk@12()  + 0x12 octets
ntdll.dll!___RtlUserThreadStart@8()  + 0x27 octets
ntdll.dll!__RtlUserThreadStart@8()  + 0x1b octets

I will try with Qt 4.7.4

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 ,
May 21, 2012 May 21, 2012

Copy link to clipboard

Copied

I've the same results with Qt4.7.4

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 ,
May 23, 2012 May 23, 2012

Copy link to clipboard

Copied

Not sure what is happening. Is this after the QApplication instance has

been destroyed? Does it crash if you don't destroy the QApp instance

(just let it go out of scope)?

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 ,
Jun 01, 2012 Jun 01, 2012

Copy link to clipboard

Copied

LATEST

It doesn't change anything if I delete the QApplication or not. Sometimes Illustrator crashes just after the QApplication instanciation

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