[SOLVED] QPushButton and Icon -- How To Move Icon More To The Left?
-
I'm a noob to Qt/C++. I have a QPushButton and have learned how to use a resource file, and then use the following stylesheet settings to load an icon on that button. Now I want to know how to put some space somehow between the icon and the text? Is there a stylesheet property for that?
QPushButton { color:#ddd; border-radius:0; border:0; background-color:#555; text-align:left; padding-left:70px; qproperty-icon:url(:/images/icons/icon-scan.png); qproperty-iconSize: 20px 20px; } QPushButton:hover { background-color:#666; } QPushButton:pressed { background-color:#333; }
-
After scouring the web, it appears that the only way to do this is the very complex technique of subclassing the widget. It's easier to just put another button on it, but then I had the problem where I couldn't pass a hover event to the QPushButton underneath it. This lead me to learn the technique on StackOverflow of building an eventFilter.
1/2