How to change icon size in QMenu's action item?
-
wrote on 26 Jan 2024, 17:03 last edited by ahmed.khan
Hello,
I've created a QMenu with three actions and set icons to the actions using the setIcon method. The problem is that I am not able to adjust the size of the icons in the QMenu. Is there a way to change it?
Thanks.
{Please help me if anyone has any idea about it.}
-
Hello,
I've created a QMenu with three actions and set icons to the actions using the setIcon method. The problem is that I am not able to adjust the size of the icons in the QMenu. Is there a way to change it?
Thanks.
{Please help me if anyone has any idea about it.}
Afaics a menu always has a standard icon size which can not be changed (only by the style via PM_SmallIconSize for all icons) but I also don't see a need for it - I never saw a menu with different icon sizes.
-
Afaics a menu always has a standard icon size which can not be changed (only by the style via PM_SmallIconSize for all icons) but I also don't see a need for it - I never saw a menu with different icon sizes.
wrote on 26 Jan 2024, 17:26 last edited by ahmed.khan@Christian-Ehrlicher, In my use case i am setting up SVG as icons but they don't appear in their actual size.
Could you please elaborate an example on PM_SmallIconSize or suggest any alternatives?
I was trying to work around using QMenu's paintEvent but it didn't work either. :(
-
@Christian-Ehrlicher, In my use case i am setting up SVG as icons but they don't appear in their actual size.
Could you please elaborate an example on PM_SmallIconSize or suggest any alternatives?
I was trying to work around using QMenu's paintEvent but it didn't work either. :(
@ahmed-khan said in How to change icon size in QMenu's action item?:
Could you please elaborate an example on PM_SmallIconSize or suggest any alternatives?
There is no alternative. PM_SmallIconSize is defined by the used style as you can see here: https://doc.qt.io/qt-6/qstyle.html#PixelMetric-enum
-
@ahmed-khan said in How to change icon size in QMenu's action item?:
Could you please elaborate an example on PM_SmallIconSize or suggest any alternatives?
There is no alternative. PM_SmallIconSize is defined by the used style as you can see here: https://doc.qt.io/qt-6/qstyle.html#PixelMetric-enum
wrote on 26 Jan 2024, 18:01 last edited by@Christian-Ehrlicher thanks for the help, I will look into it.
One more question, I'v used QMenu's paintEvent for round corners. The problem is that the resulting round corners are not properly smooth. I've used QRegion and QPainterPath in the paintEvent to set menu's mask using setMask.
-
@Christian-Ehrlicher thanks for the help, I will look into it.
One more question, I'v used QMenu's paintEvent for round corners. The problem is that the resulting round corners are not properly smooth. I've used QRegion and QPainterPath in the paintEvent to set menu's mask using setMask.
wrote on 27 Jan 2024, 04:35 last edited by ahmed.khanThis post is deleted! -
@ahmed-khan said in How to change icon size in QMenu's action item?:
Could you please elaborate an example on PM_SmallIconSize or suggest any alternatives?
There is no alternative. PM_SmallIconSize is defined by the used style as you can see here: https://doc.qt.io/qt-6/qstyle.html#PixelMetric-enum
wrote on 28 Jan 2024, 04:49 last edited byThis post is deleted!
1/7