Hex Rays
Hex Rays Blog —  State of the art code analysis

IDA Pro, Python and Qt

IDA Pro 6.0 implements a cross-platform UI with the use of Qt framework. The good thing about it is that plugin writers can also develop cross-platform UI directly with Qt. But what about script writers?
In this blog post we are going to illustrate how to use PySide to create UI interfaces for IDA Pro using IDAPython.


In previous versions of IDA Pro it was possible to create custom UIs with the create_tform()/display_tform() APIs, nonetheless the code was platform specific. On MS Windows, the programmer receives an HWND of the parent form and then populates it with custom controls and then handles the window messages from a custom WindowProc().
Since previously only an MS Windows UI existed, users could not create complex UIs on other platforms and were bound to use IDA Pro SDK/form related functions such as AskUsingForm().
With IDA Pro 6.0, C++ plugin writers can directly use the Qt SDK to develop a cross-platform UI. Please refer to the qwindow same in the IDA Pro SDK.
Script writers can also use Python Qt bindings to achieve the same result.

Python bindings for the Qt framework

We evaluated both PySide and PyQt and found that both bindings work fine with IDA Pro 6.0 (We had to compile them with –DQT_NAMESPACE=QT and had to add one method to pass a QWidget* from C++ to Python).
While PyQt is much more mature and adopted by many users, we opted for PySide which works equally well and has a less restrictive license.

Writing a Hello world UI using IDAPython and PySide

In order to write a UI from IDAPython, you have to subclass the idaapi.PluginForm class. This class which essentially wraps the create_tform()/display_tform() and provides some helper functions (such as passing to Python a QWidget* that can be used by PySide as the parent widget).
A sample code will make things clearer:
After running this script, we get this form:
And of course, the form can be docked as any other built-in form. While this example is so simple, users can now create much more elaborate and complex UIs. No surprise about it but now plugin development using scripts (IDAPython) is becoming more interesting than before.
We plan to release, soon, an IDA Pro 6.0 update (bug fix release) along with IDAPython 1.4.3 (and a custom build of PySide) which are needed to run the sample code used in this post.
And lastly, for those interested to learn more about IDA Pro and its latest features you can benefit from the IDA Pro training taking place in December.
We hope that you found this blog post useful. All comments and suggestions are welcome.

Go to top of page