QPushButton SVG stylesheet scaling to max size always, can't resize
-
Howdy, want to start by wishing you all a Merry Christmas Happy Holidays and the Best New Year! Decided to do some more studying of QT during the holiday break and ran into a weird error, wonder if anyone has some tips to deal with this. Using QT Designer, I have a QPushButton setup and add a SVG resource image to it with the styleSheet option box:
image: url(:/project1/resources/images/icon1.svg); image-position:center;
Weird thing is I've been reading various posts here and on the web and can't find out why the icon1.svg is displaying max scaled everytime. Is there a way I can scale it down to say 25%? I looked up the CSS reference and the width / height and scale properties don't work at all.
Appreciate the help, thank you!
-
Hi,
Might be a silly question be why not set your SVG as icon of the QPushButton ?
-
@SGaist Great question actually and I'll look into it. Interesting, never saw that. It seems to work well if I only set the icon1.svg. Can I add some text to it? I tried using the text field for the push button now and it placed it to the right-side of the icon1.svg graphic.
-
Do you mean text over the icon ?
-
It's the QToolButton class that provides this out of the box.