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 -
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 -
@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.
-
@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.QPushButtonlayout 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 aQLabelor aQWidget, or maybe from aQAbstractButtonor derive fromQPushButtonand override itspaintEvent(). -
@Abdullah-S
I believe that is indeed the case.QPushButtonlayout 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 aQLabelor aQWidget, or maybe from aQAbstractButtonor derive fromQPushButtonand override itspaintEvent().@JonB thank you I will try it