[Interest] Styling a QPushButton via stylesheet destroys sizing

Hamish Moffatt hamish at risingsoftware.com
Mon Sep 7 09:38:07 CEST 2015


I'm trying to style buttons via the stylesheet. Just colours, border, 
font and so forth.

However as soon as I apply any property as simple as a border, the 
button no longer sizes itself according to the rules of the platform. 
For example something as simple as:

QPushButton { border: 1px solid red; }

Now the button will shrink to the width of the text, while a normal Qt 
button on Windows has a minimum width of around 100px or so.

Further, setting a min-width doesn't fix this because then the button no 
longer gets wider to fit longer text.


Any suggestions for solving this?


Hamish



More information about the Interest mailing list