Help with PyQt4 tabwidget setup
dpalmboom
dpalmboom at evafoam.co.za
Fri May 21 02:03:43 EDT 2010
I am creating an application and I'm busy designing the main layout on the
main window. What I would like to do is the following:
Create a QTabWidget with a QVBoxLayout already inside it and also a
scrollbar inside it. When a user triggers a menu item,
a QDockWidget must be created and inserted into the QVBoxLayout, but it must
not stretch to the bottom of the QTabWidget.
The QDockWidget must keep a set size in the QVBoxLayout. When the user
triggers another menu item, the next QDockWidget must go
above or below the existing QDockWidgets in the QVBoxLayout.
I currently have the following code for the QTabWidget:
class PaneTabWidget(PyQt4.QtGui.QTabWidget):
def __init__(self, tabs, parent=None):
"""
A tabwidget to go inside a Pane.
"""
super(PaneTabWidget, self).__init__(parent)
for tab in tabs:
if tab == "Properties":
self.propertiesBin()
elif tab == "Schedule":
self.scheduleBin()
elif tab == "Pricelist":
self.pricelistBin()
def setLayoutAndScrollBar(self, page):
pass
def addPanel(self, panel, type):
self.addTab(panel, type)
def propertiesBin(self):
self.page = PyQt4.QtGui.QWidget()
self.addTab(self.page, "Properties")
self.setLayoutAndScrollBar(self.page)
Right now, the dockwidget gets put into a new tab in the tab widget, but I
would like to put it into an existing
QVBoxLayout. I currently have a blank QWidget as a "placeholder" page of the
tabwidget.
If anyone can help me with this, it would be greatly appreciated.
Thanks
More information about the Python-list
mailing list