[SOLVED] Digitising (GIS)
I'am new to Qt. The task may be simple but am not getting it. Can any one help me to develop points on MousePressEvent and to develop a straight line between two consecutive points.
Here you go:
class Widget : public QWidget
Widget(QWidget *parent = 0);
void paintEvent(QPaintEvent *);
void mousePressEvent(QMouseEvent *);
#endif // WIDGET_H
this->last = QPoint(-1,-1);
void Widget::paintEvent(QPaintEvent * e)
if(this->lines.count() == 0)return;
void Widget::mousePressEvent(QMouseEvent * e)
if(this->last.x() < 0 && this->last.y() < 0)
this->lines << QLine(e->pos(), e->pos());
else this->lines << QLine(this->last, e->pos());
this->last = e->pos();
Please add "[SOLVED]" left to the topic subject if your problem is solved. Thank!
The code was really helpful. Is there any possibility to integrate the code mentioned in the link http://www.dazzle.plus.com/linux/QtCreator/part13.htm with the above mentioned code?
Come on. You got really good help: ready made code for you to play with. You can't expect others on this forum to do your work for you of integrating that into your project. If you're looking for that kind of help, please go look for a consultant instead.