Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QT Get Current Geometry for pushbutton
QtWS25 Last Chance

QT Get Current Geometry for pushbutton

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    Fenigor
    wrote on last edited by
    #1

    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);
    }
    }@

    1 Reply Last reply
    0
    • p3c0P Offline
      p3c0P Offline
      p3c0
      Moderators
      wrote on last edited by
      #2

      Hi,

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

      157

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved