Back in part 1 I showed you the first step in setting up Qt 4.8.4 with Visual Studio 2013 so you can add Qt to your IDA Pro plug-ins.
Unfortunately Visual Studio extensions are version specific. The one that comes with 4.8.4 is made for VS2010 and probably without doing some major work you won’t get it to build for VS2013.
Go to the page http://www.qt.io/download-open-source/#section-2 and under “Other Downloads”, download the the latest “Visual Studio Add-in 1.xx for Qt5”. Note just this add-in download, not the whole large Qt5 package.
Install it and now a “QT5” menu should be added to visual studio. From there you can launch the Qt designer to build custom UIs, etc.
Yes you have Qt 4.8.4, but the Qt5 extension will work fine with it; it knows there your Qt framework folder is located (usually “C:\Qt”), etc.
Now in your C++ IDA Pro plug-in project properties add:
1) “Preprocessor Defines”:
QT_DLL
QT_GUI_LIB
QT_CORE_LIB
QT_THREAD_SUPPORT
QT_NAMESPACE=QT
and one more for debug builds:
QT_NO_DEBUG
2) “Additional Include Directories”
$(QTDIR)\include
3) “Additional Library Directories” under “Link” options:
\lib\x86_win_qt (appended with where your IDA SDK is loaded)
I setup an environment variable “IDADIR” so my full line is:
$(IDADIR)\idasdk\lib\x86_win_qt
Now you can build in Qt facilities into your plug-in.
For instance a handy function to call is “QApplication::processEvents();” to process IDA’s parent Qt event queue.
As of the latest IDA version you’ll notice you don’t see any “msg()” texts in the output window until your plug-in has finished running. This call solves that problem.
Example:
msg("my message 1\n");
msg("my message 2\n");
QApplication::processEvents();
Of course this just scratches the surface of what’s available in Qt API.
Note not all support is available to you. If you look in your IDA folder you will see you only have by default three Qt DLLs: “QtCore4.dll”, “QtGui4.dll”, and “QtXml4.dll”.
So that leaves out the Qt WebKit, Sql, etc. Although you could build those DLLs your self with VS2010. The users of your plug-ins would have to want to place them there as well.
Now you probably want the ability to add a custom Qt UI to your plug-in.
I’ll show how to do that in part 3..