[PyKDE] Newbie Problem using QScrollArea
brent.villalobos at theorphanage.com
Thu Dec 7 22:55:07 GMT 2006
I am trying to make a QGroupBox scrollable by adding a QScrollArea.
However, after looking at a lot of documentation, examples, and messsages,
I'm still not understanding the secret to using QScrollArea with other
widgets. What I have is a GUI that has two group boxes -- one that contains
control widgets and the other contains an arbitrary number of image
So the idea is that if there are more thumbnails that what can be displayed
in the view area, a scroll bar will appear in the group box. The
thumbnailsGroupBox is using a FlowLayout as its layout manager. FlowLayout
is one of the layout examples that came with PyQt.
All the QScrollArea examples I've run across say that I should be able to do
something like this:
scrollArea = QtGui.QScrollArea()
And the thumbnailsGroupBox will be scrollable correct? Well, it doesn't
work in my case. The group box doesn't appear at all and if I call
"scrollArea.show()", then it appears in its own window. And the window
contains the group box, but it's the window that is scrollable, not the
groupbox itself. And if I construct the scrollArea by setting a parent like
"scrollArea = GtGui.QScrollArea(self)", then the group box appear in my
dialog box, but it's crunched up. So what am I missing?
Here is an abbreviated version of my UI constructor. It is subclassing a
class that I create using the Qt Designer. I've included the code for
creating and placing one image object, but removed the rest since they are
all the same.
class ProofSheetUI(QtGui.QDialog, Ui_ProofSheetView):
# Set up the user interface from Designer.
# Customize UI
imageLabel1 = QtGui.QLabel()
image = QtGui.QImage('myImage.png')
self.layout = FlowLayout()
self.scrollArea = QtGui.QScrollArea()
More information about the PyQt