[Interest] How to moving widgets inside the layout

Jean Richard Lima jean at jeanrl.com.br
Wed Sep 3 22:38:46 CEST 2014


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140903/cd3f2407/attachment.html>


More information about the Interest mailing list