LONG TITLE: Broken selected-item ornament with Windows 7 Theme: Menu item icon sized using QStyle::PM_SmallIconSize override.

The ornament which the Windows 7 Theme puts on a selected menu item icon -- made wider using a QStyleProxy overriding the QStyle::PM_SmallIconSize property (see below) -- isn't drawn correctly. [Qt 4.8.5 on Windows 7]. SEE the light blue rounded square ...

detail1.png

http://cadswes2.colorado.edu/~philw/...es/detail1.png

Note that the Bullet (dot) is part of the icon. This was done because checkable menu items (QActions) having an icon don't show a check indicator -- and we really want the check indicator. [ See thread: "Can Checkable QActions (menu items) with Icons also show check indicators?" ... http://www.qtcentre.org/threads/5647...eck-indicators ... ALSO: http://qt-project.org/forums/viewthread/33325/ ].

This problem doesn't exist with the Windows Classic Theme (right side):

detail2.png

http://cadswes2.colorado.edu/~philw/...es/detail2.png

Here is the QStyle::PM_SmallIconSize override code:

Qt Code:
  1. // QProxyStyle sublass to be installed on a QMenu needing to support
  2. // wider-than-usual icons. It overrides the QStyle::PM_SmallIconSize
  3. // property with the width of the QSize provided by the client.
  4.  
  5. class QMenuIconSizeProxyStyle : public QProxyStyle
  6. {
  7. private:
  8. QSize _iconSize; // note: only the width is currently used.
  9.  
  10. public:
  11. QMenuIconSizeProxyStyle() : QProxyStyle() {}
  12.  
  13. void setIconSize (const QSize& iconSize) { _iconSize = iconSize; }
  14.  
  15. int pixelMetric (QStyle::PixelMetric metric,
  16. const QStyleOption* option=NULL,
  17. const QWidget* widget=NULL) const override
  18. {
  19. if (metric == QStyle::PM_SmallIconSize)
  20. return (_iconSize.width());
  21.  
  22. // Return base class result
  23. return QProxyStyle::pixelMetric (metric, option, widget);
  24. }
  25. };
  26.  
  27. ... ... ...
  28.  
  29. // Instantiate a QProxyStyle for a modified QStyle::PM_SmallIconSize
  30. // and install that on the QMenu.
  31.  
  32. QMenuIconSizeProxyStyle* proxyStyle = new QMenuIconSizeProxyStyle;
  33. proxyStyle->setIconSize (maxIconSize); // QSize
  34. myMenu->setStyle (proxyStyle);
To copy to clipboard, switch view to plain text mode 

Is there some other QStyle Pixel Metric I can also override which would cause the selected-item Windows 7 ornament to draw correctly (around the full revised-width of the menu icon / check indicator area)? Or is there any other way to fix this?

Reference: http://qt-project.org/doc/qt-4.8/qst...xelMetric-enum
[Thank you in advance].