Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.
Hi,
I am new at working with QStylesheets and am not able to get a button with background Image and an icon working correctly. Can someone please help me with the spacing and padding issue here or is this something I would need to use styles for?
In general all my buttons use the following stylesheet which works fine.
QPushButton{
color: black;
border-image: url(../qss/NormalButton.png) 2 10 2 10 stretch;
border-top: 2px transparent;
border-bottom: 2px transparent;
border-right: 10px transparent;
border-left: 10px transparent;
font-family:"Tahoma";
font: 10px;
min-height:28px;
max-height:28px;
}
for this button I need to add an icon so I added
#RotateLeft{
image:url(../qss/RotateLeft.png), url(RotateLeft_roll.png) selected, url(RotateLeft_disabled.png) disabled;
image-position: left;
text-align:center;
padding-left: -6px;
padding-right: -6px;
}
and what I see is the icon and text overlapping.
If I delete the padding -6px lines, the icon and text both move towards the inside and the button size increases a little. But how do I calculate the size of the button to be the size of the button + size of icon using StyleSheets. I don't want to arbitrarily increase the button width because on localization, the text on the button would change and could be much longer.