>>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.
Ok, I think that makes sense. Removing does fix the issue.
>> 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?
Yes. The child window that is.
>> 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.
Yeah, I'm kinda finding that out (the frustration part). I'll look into more
on the
layout sizing policies.
>> 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
>further?
>David
A friend of mine asked me that same question about using QSplitter. I guess I
could, I
just don't think it would have the 'feel' I'm looking for.
The simple explanation is it should work just like the designer in Crystal
Reports, but I'll
try and explain a little more just what that means.
In the code I posted, when it runs there are three, what I call, Bands. Each
band is separated
by a Resizer. The area above the Resizer will be a custom edit control where I
can, for
example, drop a text object (not a QLabel).
Now, the top band will be a page header, the middle will be a detail band and
the bottom
a page footer. I want to be able to insert more bands in the report as
necessary (i'll support
grouping and what not, but maybe not initially).
How the control should behave is if I were to grab the Resizer below the page
header band
and drag it larger the edit area for the page header would get bigger (possibly
to support
a larger font) and this action will push down the lower two bands without
resizing them at all.
If I make a mistake and want to make the page header smaller I would grab the
resizer and drag it
up and this would also pull up the lower bands, again without resizing them.
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.)
I hope this all makes sense.
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.
Thanks for taking a look at this,
Lee
_______________________________________________
PyQt mailing list [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt