Advertisement
Guest User

MyWidget.h

a guest
May 2nd, 2012
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. #ifndef MYWIDGET_H
  2. #define MYWIDGET_H
  3. #include <QDialog>
  4. #include <QtGui>
  5. #include <QtCore>
  6.  
  7. class MyWidget:public QDialog
  8. {
  9. Q_OBJECT
  10. private:
  11. QPainter *p;
  12. public:
  13. MyWidget(QDialog * obj = 0): QDialog(obj) {p=new QPainter; }
  14. virtual void paintEvent(QPaintEvent *){
  15. p->begin(this);
  16. p->setPen(QPen(Qt::black, 3));
  17. int n=2000;
  18. int i=0;
  19. while(i<2000){
  20. qreal fAngle = 2 * 3.14 * i / n;
  21. qreal x = 50 + cos(fAngle) *40;
  22. qreal y = 50 + sin(fAngle) *40;
  23. p->drawPoint(QPointF(x, y));
  24. i++;
  25. }
  26. p->end();
  27. }
  28. };
  29.  
  30.  
  31.  
  32.  
  33. #endif // MYWIDGET_H
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement