I tried this:
Qt Code:
  1. void ShiftOpGroup::setThisStyle()
  2. {
  3. QString style =
  4. "QPushButton { "
  5. "color: white; "
  6. "background-color: "
  7. "qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,"
  8. "stop: 0 #08080a, stop: 1 #66777a); "
  9. "border: 6px solid white; "
  10. "border-style: sunken; border-width: 2px; "
  11. "border-radius 6px; border-color: white; }"
  12. "QPushButton:pressed { "
  13. "color: black; background-color: aqua;"
  14. "background-color: "
  15. "qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,"
  16. "stop: 0 #eaebfe, stop: 1 #76878a); "
  17. "border-style: raised; border-width: 3px;"
  18. "border-radius 4px; border-color: black;}";
  19.  
  20. this->setStyleSheet(style);
  21. }
To copy to clipboard, switch view to plain text mode 

... but that does nothing.

What I've had to do is to connect the "pressed" and "released" signals of each QPushButton to a slot that sets the style.

Like this ...

Qt Code:
  1. class ShiftOpGroup : public QWidget
  2. {
  3. Q_OBJECT
  4. public:
  5. explicit ShiftOpGroup(QPoint *start, QWidget *parent = 0);
  6.  
  7. :
  8. QButtonGroup *buttonGroup;
  9. :
  10.  
  11. public slots:
  12. void sbPressed(int);
  13. void sbReleased(int);
  14. :
  15. }
  16.  
  17.  
  18. ShiftOpGroup::ShiftOpGroup(QPoint *start, QWidget *parent) :
  19. QWidget(parent)
  20. {
  21. :
  22. connect(buttonGroup, SIGNAL(buttonPressed(int)), this, SLOT(sbPressed(int)));
  23. connect(buttonGroup, SIGNAL(buttonReleased(int)), this, SLOT(sbReleased(int)));
  24. :
  25.  
  26.  
  27. void ShiftOpGroup::sbPressed(int pbIndex)
  28. {
  29. QString style =
  30. "color: white; "
  31. "background-color: "
  32. "qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,"
  33. "stop: 0 #08080a, stop: 1 #66777a); "
  34. "border: 6px solid white; "
  35. "border-style: sunken; border-width: 2px; "
  36. "border-radius 6px; border-color: white; ";
  37.  
  38. pShiftButtons->widgetList[pbIndex]->setStyleSheet(style);}
  39.  
  40. void ShiftOpGroup::sbReleased(int pbIndex)
  41. {
  42. QString style =
  43. "color: black; background-color: aqua;"
  44. "background-color: "
  45. "qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,"
  46. "stop: 0 #eaebfe, stop: 1 #76878a); "
  47. "border-style: raised; border-width: 3px;"
  48. "border-radius 4px; border-color: black; ";
  49.  
  50. pShiftButtons->widgetList[pbIndex]->setStyleSheet(style);
  51. }
To copy to clipboard, switch view to plain text mode 

I have to do that for every QPushButton in every subclass.

There's got to be a better way.

I tried doing it application-wide, and subclass-wide, but it does not seem to work unless I capture the "pressed" and "released" signals for each QPushButton.