How to resize a QPushButton which is inside of a Layout?
the command
has no effect!Qt Code:
button->setGeometry(p1,p3,w,h);To copy to clipboard, switch view to plain text mode
Best Regards?
How to resize a QPushButton which is inside of a Layout?
the command
has no effect!Qt Code:
button->setGeometry(p1,p3,w,h);To copy to clipboard, switch view to plain text mode
Best Regards?
You are not supposed to resize widgets managed by a layout by hand. It's the layout's responsibility to provide sufficient geometries. There are numerous ways to adjust the behavior. Size hints, size policies, stretch factors and spacers, spacings, margins, nested layouts etc. I'd suggest starting with reading about layout classes and going through the basic examples.
If in doubt, provide a screenshot of what you've got so far and explain how would you like it to be and we might be able to give hints.
J-P Nurmi
viking (27th April 2007)
If you still really need to resize the button, use QWidget::setFixedSize() just be warned that you shouldn't do that if you don't have to. A better (but still not the best) approach is to use QWidget::setMinimumSize() and QWidget::setMaximumSize() to allow some flexibility.
viking (27th April 2007)
Ok, I got that, but I have dynically located buttons in QGridLayout, which is taking too much place in my app. How do I resize it? Shold I resize every pushbutton added to QGridLayout or resize QGridLayout itself?
Qt 5.3 Opensource & Creator 3.1.2
Bookmarks