[PyQt] RE: PyQt newbie needs some help with a small report designer program

David Boddie david at boddie.org.uk
Tue Jun 16 01:36:28 BST 2009


On Thu Jun 11 01:22:05 BST 2009, Lee wrote:

> >You call its setBackgroundRole() method in its paintEvent()
> > implementation. This appears to cause another paint event to be sent to
> > the Resizer object, so you just keep receiving paint events.
>
> Ok, I think that makes sense.  Removing does fix the issue.

You can call setBackgroundRole() in the widget's __init__() method if you
want.

[...]

> If the resizing of the page header pushes the lower band(s) past the
> viewable area of the child window, I want the scroll bar to come up and
> allow me to scroll down to make that part visible. (This last part seems to
> be working.)

So, if I've understood correctly, you want a window containing a vertical
arrangement of bands, each of which can be resized.

When a band is resized, the total amount of space taken up by the bands
changes, but the size of the window itself doesn't change, so what you
really want is a viewport onto a canvas or widget containing the bands.

> I hope this all makes sense.

I think so.

> My reasons for doing this is I find that every now and then I have the need
> for a very lightweight reporting component in python.  Also, I have been
> wanting to learn Qt, so I figured I would tackle both at the same time.

I think having a project you want to build is probably the best way to
learn something. This might be a bit of a tricky starting project because
I'm not sure that QSplitter can do what you want out of the box.

My initial idea was to put a QSplitter into a QScrollArea and add widgets
to it, but that doesn't work as desired because QSplitter always tries to
reduce the space taken up by one widget when you increase the size of
another.

David


More information about the PyQt mailing list