PyQt5 how to add icon on text or above text in pushbutton
-
Hi, is that possible to add icon on text or above text in pushbutton ?
I could not find any information about this question in forums and documentations -
@Abdullah-S
First, what is the issue withQPushButton::setIcon()
? If that does not do what you want then explain what is lacking and we can review from there. -
@JonB said in PyQt5 how to add icon on text or above text in pushbutton:
QPushButton::setIcon()
thank you for answer but my problem is not with adding icon, I can add icon on pushbutton but I cannot move it on the text or above the text.
-
@Abdullah-S
I believe that is indeed the case.QPushButton
layout is limited. If you cannot get what you want in CSS or code --- which does not surprise me forQPushButton
--- then you must "roll your own" "pressable button" instead, e.g. from aQLabel
or aQWidget
, or maybe from aQAbstractButton
or derive fromQPushButton
and override itspaintEvent()
.