- QBrush brush;
- if(isEnabled()) {
- brush = QBrush(_color);
- } else {
- brush = QBrush(_color, Qt::Dense4Pattern);
+ // Draw bevel
+ style()->drawControl(QStyle::CE_PushButtonBevel, &opt, &painter, this);
+
+ // Calc geometry
+ QRect labelRect = style()->subElementRect(QStyle::SE_PushButtonContents, &opt, this);
+ int shift = style()->pixelMetric(QStyle::PM_ButtonMargin);
+ labelRect.adjust(shift, shift, -shift, -shift);
+ int x, y, w, h;
+ labelRect.getRect(&x, &y, &w, &h);
+
+ if(isChecked() || isDown()) {
+ x += style()->pixelMetric(QStyle::PM_ButtonShiftHorizontal);
+ y += style()->pixelMetric(QStyle::PM_ButtonShiftVertical);