[PyQt] All QGroupBoxs stretchables with a QStackWidget?

David Boddie david at boddie.org.uk
Sat Oct 27 18:35:22 BST 2007


On Fri, 26 Oct 2007 21:35:46 +0200, alteo_gange wrote:

> Why all QGroupBoxs are stretchables when i rise size window in file1.txt
> without QStackWidget and not in file2.txt with QStackWidget?
>
> How have all QGroupBoxs stretchables with QStackWidget?

Do you want them all to stretch as you resize the window? If so, try
experimenting with the "stretch" argument to the QVBoxLayout.addWidget()
method:

  http://www.riverbankcomputing.com/Docs/PyQt4/html/qboxlayout.html#addWidget

I tried setting this to 1 for both the first QGroupBox and the QStackedWidget
itself:

  group=QGroupBox("groupbox1")
  hbox=QHBoxLayout(group)
  hbox.addWidget(QLabel("label1"))
  vbox.addWidget(group, 1)

  ...

  vbox.addWidget(stacked, 1)

Now, both the immediate children of the QWidget are treated equally.

David



More information about the PyQt mailing list