I am trying to do something similar by changing the button icon. But I am using an icon the is not square. It is twice as wide as it is high. The icon is displayed but is not taking up the whole area of the button (I have set the header width to be twice as wide as it is high). To overcome this I am using:

Qt Code:
  1. btn->setIconSize(m_iconSize);
  2. QPixmap pixmap = btn->icon().pixmap(m_iconSize, QIcon::Normal, QIcon::On);
  3. QStylePainter painter(btn);
  4. painter.drawItemPixmap(btn->rect(), Qt::AlignCenter, pixmap);
To copy to clipboard, switch view to plain text mode 

Instead of

Qt Code:
  1. btn->setIconSize(m_iconSize);
  2. QStylePainter painter(btn);
  3. painter.drawControl(QStyle::CE_Header, opt);
To copy to clipboard, switch view to plain text mode 

So that the icon pixmap is being directly drawn to the area where the control is. This works but not as well as I would like. Is there any way to force painter.drawControl() to draw the icon full size?