Vincenzo
19th October 2008, 22:15
I want paint some circle by press the mouse button.
void GraphArea::mousePressEvent1(QMouseEvent *event)
{
if (event->button() == Qt::LeftButton) {
show = true;
}
}
void GraphArea::paintEvent(QPaintEvent * /*event*/)
{
QPainter painter(this);
if (show)
paintCircle1(painter);
}
It works...
...but my plan/problem is: if i press mouse button 2nd time, then paint 2nd circle, to third press clear the whole widget - I don't know how to do it!
PS.: sorry for my english...
void GraphArea::mousePressEvent1(QMouseEvent *event)
{
if (event->button() == Qt::LeftButton) {
show = true;
}
}
void GraphArea::paintEvent(QPaintEvent * /*event*/)
{
QPainter painter(this);
if (show)
paintCircle1(painter);
}
It works...
...but my plan/problem is: if i press mouse button 2nd time, then paint 2nd circle, to third press clear the whole widget - I don't know how to do it!
PS.: sorry for my english...