Skip navigation
nosleduc
Currently Being Moderated

Qt sample

May 11, 2012 10:23 AM

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 ?

 
Replies
  • Currently Being Moderated
    May 14, 2012 6:49 AM   in reply to nosleduc

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    May 15, 2012 6:50 AM   in reply to nosleduc

    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:");

     
    |
    Mark as:
  • Currently Being Moderated
    May 16, 2012 9:07 AM   in reply to nosleduc

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    May 23, 2012 6:04 AM   in reply to nosleduc

    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)?

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points