Important: Please read the Qt Code of Conduct -

What is wrong with the size functions for widgets?

  • Hi,

    My laptop is about 14 inches wide and I attached an image of my GUI to show you that the zero button is not 480 px. I'm trying to get the width so that I can multiply it by 2. Oh, I used the qDebug function to get that output in case you wanted to know.


  • I think you should use

    gridLayout->addWidget( button[0], 7, 0, 1, 2 );

    i.e. the row span is one and the column span is two.

    Edit: if this doesn't help, you can try to play with the alignment of the button as well.

  • @JohanSolo

    Thanks a lot man. What I discovered was that you have to call if after you show the window to get the size. After you get the sizes via qDebug, you can then proceed with the programming. And yeah, I did tried to do that, it just didn't change the button size to fit the grid.


Log in to reply