- painter.fillRect(rect().adjusted(border+1, border+1, -border-1, -border-1), QBrush(_color));
+
+ // if twice buttonMargin (+2 px from the adjust) is greater than the button height
+ // then set the border to a third of the button height.
+ if(2*border+2 >= event->rect().height()) border = event->rect().height()/3;
+
+ QBrush brush;
+ if(isEnabled()) {
+ brush = QBrush(_color);
+ } else {
+ brush = QBrush(_color, Qt::Dense4Pattern);
+ }
+ painter.fillRect(rect().adjusted(border+1, border+1, -border-1, -border-1), brush);