[PyQt] PyQt newbie needs some help with a small report designer
david at boddie.org.uk
Wed Jun 10 01:00:46 BST 2009
On Tue Jun 9 23:56:21 BST 2009, Lee wrote:
> I'm new to pyqt and am having a bit of trouble. I'm trying to make a
> (_very_) simple report designer. Right now I'm just trying to get a feel
> for what I can do in pyqt and so I've laid out a simple program that
> represents a document with several bands (if you are familiar with Crystal,
> you've seen the band style designer I'm trying to emulate). I feel I'm
> getting closer, but right now i'm just hacking at it so I feel I should ask
> for some guidance at this point. A few of the issues I'm having are:
> 1) Resizer.paintEvent is getting called... a lot. I'm not really sure why.
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.
> 2) When I resize the inner window, i don't wan't contents to resize, but if
> I don't have the inner widget set to resizable, things are worse. How can
> I have it both ways? I guess what I am trying to say is I want the only
> way to resize a band be via the Resizer (or eventually some scale factor).
Do you want the window to get larger if you make a band larger?
> Not by dragging the window. 3) General resizing issues. Top band doesn't
> get smaller when I drag the Resizer up. When i drag top Resizer down it
> makes the top one bigger the middle one gets smaller instead of just being
> pushed down, etc... What can I try in order to get the layouts to function
> like I envision?
You might have to avoid using layouts, or write your own layout manager.
Experience has taught me that trying to directly force layouts to do what
you want is going to lead to frustration. You might be able to get closer
to what you want if you set the widgets' size policies and disable as many
layout constraints as possible.
> Any guidance on what I can try to straighten some of these issues out would
> be appreciated. Or, if I'm just going about this the wrong way, please let
> me know (though I've swiped the ideas from several similar projects...)
I'm curious as to why you aren't using QSplitter for this, but I'm not
exactly clear as to how the widget is supposed to behave. Can you explain
More information about the PyQt