[PyQt] Qt4: Open a QDialog.
tinaweb at bestemselv.com
Tue Mar 13 08:08:08 GMT 2007
Andreas Pakulat wrote:
> On 12.03.07 09:44:48, Tina I wrote:
>> I'm having some problems moving from Qt3 to Qt4. Kinda stuck in old habits I
>> Anyway, my current problem is to simply open a dialog window I have made with
>> Designer but I can't for the life of me understand how to do it. In Qt3 it was
>> just a matter of importing the dialog and do something like "if
>> dialog.exec_loop() == QDialog.Accepted:". I have looked at the examples but I'm
>> none the wiser I'm afraid.
> Its really easy:
> if( dlg.exec_() == ... ):
> The Ui_Dialog class you created in designer only contains code that adds
> the widgets to a given QDialog or QWidget parent. Its not a QDialog
> subclass anymore. The approach above of course only works if you don't
> need extra code to handle the dialog. If you do you'd create a subclass
> from QDialog and do the same thing as with the mainwindow (self.ui =...
> self.ui.setupUi(this)). This is documented in the Qt4 designer manual,
> to be found on doc.trolltech.com/4.2
Excellent! Thanks for the explanation. Now I get it. :)
More information about the PyQt