Qt Forum - programming with C++ and Qt
Register Calendar Members List Team Members Search Frequently Asked Questions Go to the Main Page

Qt Forum - programming with C++ and Qt » QtForum.org » Qt » Qt Programming » button with backgr and icon using stylesheets » Hello Guest [Login|Register]
Last Post | First Unread Post Print Page | Recommend to a Friend | Add Thread to Favorites
Post New Thread Post Reply
Go to the bottom of this page button with backgr and icon using stylesheets
Author
Post « Previous Thread | Next Thread »
s_p_t10
Assistant


Registration Date: 08.05.2008
Posts: 4

Level: 3 [?]
Experience: 32
Next Level: 54

22 points of experience needed for next level

button with backgr and icon using stylesheets Reply to this Post Post Reply with Quote Edit/Delete Posts Report Post to a Moderator       Go to the top of this page

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.

Please help. Thanks

s_p_t10 has attached this image (reduced version):
btn.png

08.05.2008 22:14 s_p_t10 is offline Send an Email to s_p_t10 Search for Posts by s_p_t10 Add s_p_t10 to your Buddy List
Tree Structure | Board Structure
Jump to:
Post New Thread Post Reply
Qt Forum - programming with C++ and Qt » QtForum.org » Qt » Qt Programming » button with backgr and icon using stylesheets

views today: 9.231 | views yesterday: 17.520 | total views: 10.242.600


Klebekork Shop - Linux Shop - Kontaktanzeigen - Linux Forum -  SMS Gewinnspiel -  Hotels -  Stadtpläne -  Branchenbuch & Stadtplan

Branchenbuch Österreich - Branchenbuch Niederlande - Portugal Branchenverzeichnis - Spanien Branchenverzeichnis 
Telefonbuch - Branchenbuch Frankreich