[Interest] How to moving widgets inside the layout
Igor Mironchik
igor.mironchik at gmail.com
Wed Sep 3 23:23:15 CEST 2014
Hi,
try QLayoutItem * QVBoxLayout::takeAt( int index ) and then void QVBoxLayout::insertItem( int index, QLayoutItem * item )
...
From: Jean Richard Lima
Sent: Wednesday, September 03, 2014 11:38 PM
To: interest at qt-project.org
Subject: [Interest] How to moving widgets inside the layout
Hi people!
I need moving widgets inside the layout must do exactly as is done in designer mode, move widgets within the layout and other widgets automatically realign, example:
I have 4 widgets and want to get 3 and move the mouse to one above the 1st position, then he should be the first and realign the rest, I’m just not getting it.
My mousePressEvent method is as follows:
x = ev->globalX();
y = ev->globalY();
My mouseMoveEvent method is as follows:
if(ev->buttons() & Qt::LeftButton)
{
move(ev->globalX()-this->x,ev->globalY()-this->y);
}
in my mouseReleaseEvent is:
setGeometry(ev->globalX()-this->x, ev->globalY()-this->y, width(), height());
The object is moving normally, but when released the mouse button, it stays where it is and nothing is redesigned and I need you to do exactly as the designer, when you move an object in a QVBoxLayout after releasing the mouse button everything is realigned automatically and the object being dragged into the new position.
Does anyone have any tips for me.
Thank you.
Jean Richard Lima
Consultor de Gestão e TIC
Software House de Projetos Específicos
--------------------------------------------------------------------------------
_______________________________________________
Interest mailing list
Interest at qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140904/482c67d8/attachment.html>
More information about the Interest
mailing list