I create a Mainwindow for my plugin, but if I want to open a second window from this Mainwindow, with click on push button. How can I do?
I tried the following function in my Main Class:
dialog = QDialog()
dialog.ui = Ui_SecondWindow()
dialog.ui.setupUi(dialog)
dialog.exec_()
But does not work.
I use QGIS 2.4 and PyQt 4.
Best Answer
If you have compiled your Ui file to a .py with pyuic then you setup like this:
yourplugin_dialog.py:
Or to compile at runtime from the.ui file:
And create the instance wherever you want to use the dialog: