Mixing absolute positionning with VBoxLayout
-
-------------------------Main Window -------------------------------
@ ---------- VBoxLayout------------------ ------Resizable Widget----- <<< Handle to resize by drag up and down. ----------------------------------- ------Resizable Widget----- ----------------------------------- |
@ Hope my drawing is clear,, I need to be able to resize by dragging up and down different widget.
The widgets are stack within a QVerticalLayout, .. this is basically a stack of resizable and dockable widget.
I have many stack of QWidget, I need to be able to drag them off their current stack to other and also be able to drag up and down to change their individual size.
The drag from one stack to an other is well covered. I just fail to resize folowing the mouse having the layout still active.
@void ResizeGrip::mouseMoveEvent(QMouseEvent *event)
{
if (event->buttons() & Qt::LeftButton) {
move(event->globalPos() - dragPosition);
topPos=event->globalPos() - dragPosition;
event->accept();
resizeToFit();
}
}@When i work with the move alone and force geometry of the widget it folow perfectly the only problem is that the Layout stop working after, and if i do update gemoetry all my manual changes are discarted.
-
Hi,
Wouldn't a "QSplitter":http://qt-project.org/doc/qt-5/qsplitter.html more suited for your design ?
-
Well I thought about it, but a spliter is made to divide space, like between windows.. in this case if the bottom widget is push up .. the other need to float above not be resized. It would work well with Spring Layout.. but the entire code is with QWidget and Achor layout .. is only with QGraphics objects..
-
In that case you should probably either create your own layout manager or manage the widgets yourself. The current layouts available for widgets are all handling the resizing of their content.
-
yea i was really affraid of that.. I whant it to only manage position.. vertically.. and size horizontally.. the crazy thing is that this is the 3rd time in 3 language different for 3 company different that i had to implement that type of behavior you would think that something common like that would have more support but every time its allot if gymnastic to get it to work.. thanks for the help.
-
Can you give me an example of a widget based software that uses this kind of functionality ?
-
Grammar editor.. for voice recognition system.. where all the alternatives are some sort of Form(edition and display widget).. are listed on top of each other.. ore just imagine that you have a Blog application where you whant to be able to reorder and resize all the posts..
-
Isn't it more like an mdi application ?
-
Yes and no... very similar in many way every item in the list can indeed be seen as a document.. but the whanted display behavior is a bit complex.. My first try was to put the elements into a QList.. to give you an idea of how they should appear, The order of the elements have meaning, and they really should appear in a list.. its even possible to move elements from one list to an other with drag and drop operation.. the various list are themself within similar list layout.. and can them self be moved from one stack to an other by drag and drop and be resized as well..
-
I see what you mean.
You should also have a look at the Model/View Framework