[PyKDE] QDialog geometry problem

David Boddie david at boddie.org.uk
Thu Mar 11 12:17:01 GMT 2004


On Wed, 10 Mar 2004 21:55:37 -0600, Mike Meyer <mwm at mired.org> wrote:

> I'm trying to set up a simple dialog box, with a QLineEdit and a
> couple of QPushButtons. The init code is:
>
> class FindDialog(QDialog):
>     def __init__(self, parent = None, name = None, modal = False, flags =
> 0): QDialog.__init__(self, parent, name, modal, flags)
>
>         col = QVBox(self, "find column")
>         self.Text = QLineEdit(col, "find line edit")
>         row = QHBox(col, "find row")
>         find = QPushButton("Find", row, "find find")
>         find.setDefault(True)
>         self.connect(find, SIGNAL("clicked()"), self.Find)
>         close = QPushButton("Close", row, "find close")
>         self.connect(close, SIGNAL("clicked()"), self.Close)
>
> The dialog window is opening with the buttons, but it only the upper
> left-hand corner of the dialog is rendered. That gets the top of the
> left button, and the upper left corner of the right button.

You need to add a layout to the dialog, and add the vbox object to it:

         layout = QVBoxLayout(self)
         layout.addWidget(vbox)

Good luck!

David




More information about the PyQt mailing list