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.
In general all my buttons use the following stylesheet which works fine.
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;
}
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;
}
To copy to clipboard, switch view to plain text mode
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;
}
#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;
}
To copy to clipboard, switch view to plain text mode
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.
Please help. Thanks
Bookmarks