Maya uses a customized version of Nokia's Open Source Qt 4.7.1 framework (for Maya 2013).
If you want to use Qt in your Maya plug-ins then you will have to use the same modified version as Maya. Most of the Qt modified libs ship with the Maya distribution (located in $MAYA_LOCATION/lib). So in theory you would not need build the libraries yourself unless you need more. Then it will require that you build a local copy of Qt from the customized source.
A copy of the customized Qt 4.7.1 source is available from Autodesk's Open Source web-site (http://www.autodesk.com/lgplsource) whereas the compressed file in the Maya distribution (the compressed file in the $MAYA_LOCATION/include/Qt folder) contains header file only. The WEB version includes text files describing how to configure, build and install Qt for each platform supported by Maya.
I would also encourage you to read Kristine's article on Qt, PyQt, and PySide before anything.
If you were writing your own Qt application from scratch, you would need to create your own QCoreApplication or QApplication instance to handle your application's event loop. When writing a Maya plug-in, you must instead use Maya's own application object which can be retrieved using Qt's qApp macro.
#include <QtCore/QCoreApplication> QCoreApplication *app = qApp;
From there you can use the Qt installEventFilter() method to trap all Application event.
void QObject::installEventFilter (QObject *filterObj)
In standalone mode, Maya does only create a basic QCoreApplication. I.e. no GUI, that is the most that Maya will do in batch mode. But Maya will nicely use any Qt application already running, so you need to create your own Qt appplication before initializing Maya standalone libraries and then you can access the event loop as usual.
Comments