[Qt-interest] How to apply scroll bars in mdi files.

Tony Rietwyk tony.rietwyk at rightsoft.com.au
Wed Apr 22 16:25:03 CEST 2009


Kamakshi Sivaraman wrote:

Thank you for the response. But I still have problem in resolving my issue. 
if I paint on MDI child window or subwindow and if the painting exceeds the
subwindow size. 
For Eg: I painted a line in the subwindow and if the size of line exceeds
the size of MDI subwindow then I expect a Horizontal scroll bar or Vertical
scroll bar based on the area painted, but I am not getting any such scroll
bar.Instead I need to use mouse pointer to increase the size of subwindow
and see the diagram. 
 

Hi, 
 
If you paint outside the size of the widgets, the paint is ignored - it does
NOT automatically resize the widget.  You need to:
 
- set the size of your custom widget to the size of the diagram (not in the
paintEvent though). 
- override or filter the paint event of the widget to draw the diagram. 
- set the widget into the scroll area using setWidget. 
 
The scroll bars will appear when your widget inside the QScrollArea has a
large size. 
 
I suggest you get your custom widget working first on its own without any
main window.  Have a look at the analog clock example.  Then look at the
text edit mdi example, as previously suggested, but use combinations of a
scrollarea and your widget instead. 
 
Hope that helps, 
 
Tony.
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090423/ae00717e/attachment.html 


More information about the Qt-interest-old mailing list