<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman,new york,times,serif;font-size:12pt"><div><pre>>>On Tue Jun 9 23:56:21 BST 2009, Lee wrote:<br><br>>><i> I'm new to pyqt and am having a bit of trouble. I'm trying to make a<br></i>>><i> (_very_) simple report designer. Right now I'm just trying to get a feel<br></i>>><i> for what I can do in pyqt and so I've laid out a simple program that<br></i>>><i> represents a document with several bands (if you are familiar with Crystal,<br></i>>><i> you've seen the band style designer I'm trying to emulate). I feel I'm<br></i>>><i> getting closer, but right now i'm just hacking at it so I feel I should ask<br></i>>><i> for some guidance at this point. A few of the issues I'm having are:<br></i>>><i><br></i>>><i> 1) Resizer.paintEvent is getting called... a lot. I'm not really sure
why.<br></i><br>>You call its setBackgroundRole() method in its paintEvent() implementation.<br>>This appears to cause another paint event to be sent to the Resizer object,<br>>so you just keep receiving paint events.<br><br>Ok, I think that makes sense. Removing does fix the issue. <br><br><br>>><i> 2) When I resize the inner window, i don't wan't contents to resize, but if<br></i>>><i> I don't have the inner widget set to resizable, things are worse. How can<br></i>>><i> I have it both ways? I guess what I am trying to say is I want the only<br></i>>><i> way to resize a band be via the Resizer (or eventually some scale factor).<br></i><br>>Do you want the window to get larger if you make a band larger?<br><br>Yes. The child window that is. <br><br>>><i> Not by dragging the window. 3) General resizing issues. Top band doesn't<br></i>>><i> get smaller when I drag the Resizer up. When i drag top
Resizer down it<br></i>>><i> makes the top one bigger the middle one gets smaller instead of just being<br></i>>><i> pushed down, etc... What can I try in order to get the layouts to function<br></i>>><i> like I envision?<br></i><br>>You might have to avoid using layouts, or write your own layout manager.<br>>Experience has taught me that trying to directly force layouts to do what<br>>you want is going to lead to frustration. You might be able to get closer<br>>to what you want if you set the widgets' size policies and disable as many<br>>layout constraints as possible.<br><br>Yeah, I'm kinda finding that out (the frustration part). I'll look into more on the <br>layout sizing policies.<br><br><br><br>>><i> Any guidance on what I can try to straighten some of these issues out would<br></i>>><i> be appreciated. Or, if I'm just going about this the wrong way, please let<br></i>>><i> me know (though
I've swiped the ideas from several similar projects...)<br></i><br>>I'm curious as to why you aren't using QSplitter for this, but I'm not<br>>exactly clear as to how the widget is supposed to behave. Can you explain<br>>further?<br><br>>David<br><br><br>A friend of mine asked me that same question about using QSplitter. I guess I could, I <br>just don't think it would have the 'feel' I'm looking for.<br><br>The simple explanation is it should work just like the designer in Crystal Reports, but I'll<br>try and explain a little more just what that means.<br><br>In the code I posted, when it runs there are three, what I call, Bands. Each band is separated<br>by a Resizer. The area above the Resizer will be a custom edit control where I can, for<br>example, drop a text object (not a QLabel). <br>Now, the top band will be a page header, the middle will be a detail band and the bottom<br>a page footer. I want to be able to insert more bands
in the report as necessary (i'll support<br>grouping and what not, but maybe not initially).<br><br>How the control should behave is if I were to grab the Resizer below the page header band<br>and drag it larger the edit area for the page header would get bigger (possibly to support<br>a larger font) and this action will push down the lower two bands without resizing them at all.<br>If I make a mistake and want to make the page header smaller I would grab the resizer and drag it<br>up and this would also pull up the lower bands, again without resizing them.<br><br>If the resizing of the page header pushes the lower band(s) past the viewable area of the child <br>window, I want the scroll bar to come up and allow me to scroll down to make that part visible. <br>(This last part seems to be working.)<br><br><br>I hope this all makes sense. <br><br>My reasons for doing this is I find that every now and then I have the need for a very <br>lightweight
reporting component in python. Also, I have been wanting to learn Qt, so I figured<br>I would tackle both at the same time.<br><br><br>Thanks for taking a look at this,<br>Lee<br><br><br><br><br><br><br><br><br></pre></div></div><br>
</body></html>