Thank you for the pointer... here's what I tried.
I derived my own style from QPlastiqueStyle and overrode the pixelMetric() function. QPlastiqueStyle calls its pixelMetric() method when it is drawing a menu item, to find out the pixel metrics for PM_SmallIconSize. My overridden class re-implements the virtual pixelMetrics like this:
int MyStyle
::pixelMetric (PixelMetric metric,
const QStyleOption* option,
const QWidget* widget
) {
qDebug () << "my menu style pixelMetric called!";
if (metric == PM_SmallIconSize)
{
return 24;
}
else
{
}
}
int MyStyle::pixelMetric (PixelMetric metric, const QStyleOption* option, const QWidget* widget)
{
qDebug () << "my menu style pixelMetric called!";
if (metric == PM_SmallIconSize)
{
return 24;
}
else
{
return QPlastiqueStyle::pixelMetric (metric, option, widget);
}
}
To copy to clipboard, switch view to plain text mode
Next, I instantiate an object of type MyStyle and pass it to my QMenu's setStyle method:
MyStyle myStyle;
menu.setStyle (&myStyle);
MyStyle myStyle;
QMenu menu;
menu.setStyle (&myStyle);
To copy to clipboard, switch view to plain text mode
However, when I pop up that menu, my pixelMetric function (in my derived class) never gets called -- and the icon is still displayed at 16x16. Any suggestions?
Thanks
Greg
Bookmarks