Files
idapython-src/examples/ui/pyqt/populate_pluginform_with_pyqt_widgets.py
2025-03-13 16:17:53 +01:00

46 lines
1.1 KiB
Python

"""
summary: create a dockable container, and populate it with Qt widgets
description:
Using `ida_kernwin.PluginForm.FormToPyQtWidget`, this script
converts IDA's own dockable widget into a type that is
recognized by PyQt5, which then enables populating it with
regular Qt widgets.
level: beginner
"""
from PyQt5 import QtCore, QtGui, QtWidgets
class MyPluginFormClass(ida_kernwin.PluginForm):
def OnCreate(self, form):
"""
Called when the widget is created
"""
# Get parent widget
self.parent = self.FormToPyQtWidget(form)
self.PopulateForm()
def PopulateForm(self):
# Create layout
layout = QtWidgets.QVBoxLayout()
layout.addWidget(
QtWidgets.QLabel("Hello from <font color=red>PyQt</font>"))
layout.addWidget(
QtWidgets.QLabel("Hello from <font color=blue>IDAPython</font>"))
self.parent.setLayout(layout)
def OnClose(self, form):
"""
Called when the widget is closed
"""
pass
plg = MyPluginFormClass()
plg.Show("PyQt hello world")