QT Get Current Geometry for pushbutton



  • I'm trying to make a function for multiple buttons.When called it gets the current geometry of the button and changes it to a new one.When called again it returns it back to the previous one.Any ideas how walk around writing down by hand the geometry for each button when you call the function?Something like getgeotmetry function? This is what i made so far and it's only pseudo code

    @currentbutton = button_object;
    function(currentbutton,x,y,width,length,bool);
    function(QPushButton* currentbutton,int x,int y,int width,int length,bool)
    {
    if(true)
    {
    currentbutton->setGeometry(x+10,y-18,width-21,length+32);
    currentbutton->setIcon(ButtonIcon);
    currentbutton->setIconSize(QSize(40,40));
    currentbutton->setFlat(true);
    }
    else
    {
    currentbutton->setGeometry(x,y,width,lenght);
    currentbutton->setIcon(QIcon());
    currentbutton->setFlat(false);
    }
    }@


  • Moderators

    Hi,

    Is "geometry":http://doc.qt.io/qt-5/qwidget.html#geometry-prop what you are looking for ?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.