- const QPixmap* icon = pixmap();
- if (icon != 0) {
- const int x = (buttonWidth - icon->width()) / 2;
- const int y = (buttonHeight - icon->height()) / 2;
- painter->drawPixmap(x, y, *icon);
- }
+ const QPixmap pixmap = icon().pixmap();
+ const int x = (buttonWidth - pixmap.width()) / 2;
+ const int y = (buttonHeight - pixmap.height()) / 2;
+ painter.drawPixmap(x, y, pixmap);