OK, here is what I'm trying to do.

I want a different frame around my pushbuttons than the one they come with. I have a subclass of QPushButton with the extras added, including their own frame. I'm thinking that I can superimpose a QFrame widget around the QPushButton and set the QFrame parameters as I choose.

Well, I just can't get the QFrames around the QPushButtons to appear.

The "parent" parameter is ui->centralWedget

What am I missing?

Here is the code, first the header, then the source. it's not large.
Qt Code:
  1. #ifndef BITBUTTON_H
  2. #define BITBUTTON_H
  3.  
  4. #include <QtCore>
  5.  
  6. class BitButton : public QPushButton
  7. {
  8. Q_OBJECT
  9. public:
  10. BitButton(int number, QWidget *parent);
  11. void bbToggle();
  12.  
  13. int bbId;
  14. int bbState;
  15. void setState(int state);
  16. void setGeometry(QRect& rect);
  17. QFrame *frame;
  18.  
  19. signals:
  20. void bbClicked();
  21.  
  22. private slots:
  23.  
  24. private:
  25. QString bbStyle[2];
  26. };
  27.  
  28. #endif
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. #include <BitButton.h>
  2.  
  3. BitButton::BitButton(int number, QWidget *parent)
  4. : QPushButton(parent)
  5. {
  6. bbId = number;
  7.  
  8. bbStyle[0] = "color: aqua; background-color: black;"
  9. "border-style: sunken; border-width: 3px;"
  10. "border-color: white;";
  11.  
  12. bbStyle[1] = "color: black; background-color: aqua";
  13.  
  14. frame = new QFrame(parent);
  15. frame->setFrameStyle(QFrame::Box | QFrame::Sunken);
  16. frame->setLineWidth(3);
  17.  
  18. QFont font;
  19. #ifdef Q_WS_WIN
  20. font.setPointSize(font.pointSize()+2);
  21. font.setFamily("Lucida Console");
  22. #endif
  23. #ifdef Q_WS_X11
  24. font.setFamily("Monospace");
  25. font.setPointSize(12);
  26. #endif
  27.  
  28. this->setFont(font);
  29. this->setState(0);
  30. }
  31.  
  32. void BitButton::setGeometry(QRect &rect)
  33. {
  34. QRect frameRect = QRect(rect.x()+2,
  35. rect.y()+2,
  36. rect.width()+2,
  37. rect.height()+2);
  38.  
  39. frame->setFrameRect(frameRect);
  40. QPushButton::setGeometry(rect);
  41. this->frame->show();
  42. }
  43.  
  44. void BitButton::bbToggle()
  45. {
  46. this->setState(bbState ^= 1);
  47. }
  48.  
  49. void BitButton::setState(int state)
  50. {
  51. bbState = state;
  52. this->setText(QString::number(state));
  53. this->setStyleSheet(bbStyle[state]);
  54. }
To copy to clipboard, switch view to plain text mode