Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Resize problem of Qwidget



  • !http://i.imgur.com/TI9uCJk.png(resize_widget)!

    Hello every one .. my problem is with resize of Qwidget i want to re-size widget as same we can resize in Qt designer.. any one help.. problem is the opposite end are not fixed they are also moving with widget when we are in minninum of its height or width.



  • i am trying to fix widget bottom-right postion... how can i get it Fixed...



  • Hi,

    Without some code it is hard to help.

    You could have a look at "the diagram scene example":http://qt-project.org/doc/qt-5/qtwidgets-graphicsview-diagramscene-example.html

    To get you further.

    Hope it helps



  • @if(cursorShape == SelectionNodeWidget::RightBottom)
    {
    qDebug() << "Hello 2";

                myPosition.setTopLeft(dw->geometry().topLeft());
                myPosition.setBottomRight(e->pos());
                dw->setGeometry(myPosition);
                qDebug() << myPosition.topLeft();
            }
            if(cursorShape == SelectionNodeWidget::RightTop)
            {
                //qDebug() << "Hello 3";
                myPosition.setBottomLeft(dw->geometry().bottomLeft());
                myPosition.setTopRight(e->pos());
                //                myPosition.setBottom(dw->geometry().bottom());
               dw->setGeometry(myPosition);
           }
    
    
            if(cursorShape == SelectionNodeWidget::LeftTop)
            {
                    myPosition.setTopLeft(e->pos());
                    myPosition.setBottomRight(dw->geometry().bottomRight());
                    dw->setGeometry(myPosition);
                    dw->resize(dw->geometry().width(),dw->geometry().height());
                    qDebug()<<myPosition.bottomRight()<<dw->geometry().bottomRight()<<e->pos();
            }
            if(cursorShape == SelectionNodeWidget::RightCenter)
            {
                myPosition.setRight(e->pos().x());
                myPosition.setTop(dw->geometry().top());
                myPosition.setLeft(dw->geometry().left());
                myPosition.setBottom(dw->geometry().bottom());
                dw->setGeometry(myPosition);
    
            }
            if(cursorShape == SelectionNodeWidget::LeftCenter)
            {
                myPosition.setLeft(e->pos().x());
                myPosition.setTop(dw->geometry().top());
                myPosition.setRight(dw->geometry().right());
                myPosition.setBottom(dw->geometry().bottom());
                dw->setGeometry(myPosition);
    
            }
    

    @
    the resizing is some what like this i have done:- every thing works fine but when ever i comes to its inital position the widgt start moving



  • Hi,
    This "link":http://www.ggkf.com/qt/implementing-resize-handles-on-qrubberband-is-qsizegrip-relevant may contain a hint to what you need to achieve.

    Good luck


Log in to reply