Re: Freeform widget layouting
On Thursday 04 August 2005 03:38, Leo Spalteholz wrote:[color=blue]
> I've been thinking about how to layout widgets in a sort of freeform
> way with QT and haven't figured out a good way to do it (I'm new at
> this whole thing).
> There are several QLayouts available but none of them seem to do what
> I need them to. That is, several rectangular (maybe polygonal in the
> future) widgets that may be overlapping, and the widget that is
> currently under the mouse pointer and on top in the z order receives
> mouse events.
> The attached image is basically what I want. every rounded rectangle
> is a widget, and each widget may be completely or partially inside
> another widget. =[/color]
Well that's what child widgets are for. In your diagram I see
a parent widget, widget 1, with 5 children. You could use a QVBoxLayout
and two QHBoxLayouts inside it to lay out those children.
> Is there a way to easily put widgets in a window at =[/color]
> arbitrary locations =[/color]
Yes, widget->move() and widget->resize(). But be careful if the contents
of the widgets can change (e.g. due to fonts or internationalization), don't
hardcode positions and sizes.
> or do I need to code my own QLayout derived class? =[/color]
I would recommend not doing that.
David Faure, [email]email@example.com[/email], sponsored by Trolltech to work on KDE,
Konqueror ([url]http://www.konqueror.org[/url]), and KOffice ([url]http://www.koffice.org[/url]).
>> Visit [url]http://mail.kde.org/mailman/listinfo/kde-devel#unsub[/url] to unsubscrib=[/color][/color]