Is it possible to define a default minimum height for a QPushButton
through a custom application wide QStyle
?
I know this can be achieved using stylesheets, but I rather not use them because of performance reasons.
Is it possible to define a default minimum height for a QPushButton
through a custom application wide QStyle
?
I know this can be achieved using stylesheets, but I rather not use them because of performance reasons.
There are two options I can see, here they are:
1) Suclass QStyle and set it to your application using
QApplication::setStyle(QStyle* yourstyle)
In QStyle, you must reimplement your own
void QStyle::drawPrimitive ( PrimitiveElement element, const QStyleOption * option, QPainter * painter, const QWidget * widget = 0 ) const
2) Subclass QPushButton and use the method
QWidget::setMinimumHeight(int minHeight);
to set the minimum height and only use this subclass in the rest of your program.
Hope this helps.
You might consider looking at the QApplication::globalStrut
property, which is designed to provide a minimum size for any user-interactive UI element. Ideally, it would do what you want (and possibly more). However, I have seen times when this was ignored, either by the widget or the style drawing the widget, so in practice it has been somewhat less than useful.