Just trying to use a QPainter to draw a line across my widget. I thought it would be easy, just not working. Here is the entire widget code.

Thanks.

Qt Code:
  1. #ifndef TOPBAR_H_
  2. #define TOPBAR_H_
  3.  
  4. #include <QtGui/QWidget>
  5. #include <QPainter>
  6. #include "ui_TopBar.h"
  7.  
  8. class TopBar : public QWidget, private Ui::TopBarClass {
  9. Q_OBJECT
  10.  
  11. public:
  12. TopBar(QWidget *parent = 0) :
  13. QWidget(parent) {
  14. setupUi(this);
  15.  
  16. QPainter painter(this);
  17. painter.drawLine(0,21,240,21);
  18. }
  19. };
  20.  
  21. #endif /*TOPBAR_H_*/
To copy to clipboard, switch view to plain text mode