My Project
line.h
1 #ifndef LINE_H
2 #define LINE_H
3 
4 #include <QWidget>
5 #include <QPainter>
6 
11 class Line : public QWidget
12 {
13  Q_OBJECT
14 public:
15 
23  explicit Line(QWidget *parent = 0);
24 
45  Line(int fromX, int fromY, int toX, int toY, int w, QColor c, QWidget *parent = 0);
46 
68  Line(int fromX, int fromY, int length, double angle, int w, QColor c, QWidget *parent = 0);
69 
83  void setCoords(int fromX, int fromY, int toX, int toY);
84 
92  void setpenColor(QColor c);
93 
101  void setPenWidth(int w);
102 
110  int getX0();
111 
119  int getY0();
120 
128  int getX1();
129 
137  int getY1();
138 
139 signals:
140 
141 public slots:
142 
143 protected:
151  void paintEvent(QPaintEvent *);
152 
153 private:
154  int x0,
155  y0,
156  x1,
157  y1;
158  int penWidth;
159  QColor penColor;
161 };
162 
163 #endif // LINE_H
Line(QWidget *parent=0)
Constructor.
Definition: line.cpp:12
int x1
Definition: line.h:154
QColor penColor
Definition: line.h:159
int y0
Definition: line.h:154
int y1
Definition: line.h:154
void setCoords(int fromX, int fromY, int toX, int toY)
Setter for the line coordinates.
Definition: line.cpp:87
int getX1()
Getter for the ending coordinate x.
Definition: line.cpp:138
void setPenWidth(int w)
Setter for the pen width.
Definition: line.cpp:111
int getY1()
Getter for the ending coordinate y.
Definition: line.cpp:147
Definition: line.h:11
int x0
Definition: line.h:154
int penWidth
Definition: line.h:158
int getY0()
Getter for the starting coordinate y.
Definition: line.cpp:129
int getX0()
Getter for the starting coordinate x.
Definition: line.cpp:120
void paintEvent(QPaintEvent *)
The paint event function is automatically invoked whenever a resize or repaint happens.
Definition: line.cpp:156
void setpenColor(QColor c)
Setter for the pen color.
Definition: line.cpp:102