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@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@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to