Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to adjust size of text inside QPushbutton
never_ever last edited by
I create buttons (my class is subclassing QPushbutton) on screen. The size of them is setted by user, but I want to check if size of button is enough big for the text in button. If not it should resize. Is there any way to check that?
You can use "QFontMetrics::width":http://qt-project.org/doc/qt-5/qfontmetrics.html#width to get the width of the button text and compare it with the width of the button.