On 8/4/05, Matt Broadstone wrote:
> On 8/3/05, Leo Spalteholz wrote:
> > Hello,
> > =


> > 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. Is there a way to easily put widgets in a window at
> > arbitrary locations or do I need to code my own QLayout derived class?
> > =


> > Thanks,
> > Leo
> > =


> It doesn't seem that you are looking for a QLayout, but instead the
> anti-layout Perhaps trying something like adding each item to a
> QFrame and then allow the items to be dragged around.. I guess my
> question is what exactly do you think you need a layout for? Or are
> you just assuming that widgets all need layouts? By the by, if you are
> interested in seeing an example of what I suggested (with the
> draggable widgets)look for the fridge magnet demo.. though it may only
> be in qt4's src tree


Hehe. Good call. It does seem like I want an anti-layout. But I
actually do want a layout, just in a very mixed up way. I suppose
what I want is a layout that will let me add widgets in terms of
percentage of layout size. It would work something like this I
suppose.

// add mywidget to the layout at the center of the layout (0.4 of
layout's height and width), with the widget's width and height being
20% of the layout's size.
myLayout->addWidget(mywidget, 0.4, 0.4, 0.2, 0.2);

I just found an interesting example in qt called customlayout, which
seems to have some useful code in it. Thanks for the QFrame
suggestion too. I notice that if I create a Mainwindow in Qt
Designer, I am able to position buttons anywhere, and also overlap
them. Does anyone know how to do this in code? How do I add a widget
at any pixel location? So far I've only been able to add widgets to
layouts.

Thanks,
Leo =

> =


> =


> =


> > =


> > =


> > >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to

> unsubscribe <<
> > =


> > =


> > =


> >

>

=

>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscrib=

e <<