how can i draw a grid of points on a widget of type QgraphicsView?
I reimplement the PaintEvent method in my custom QgraphicsView class, but i can't see the points i draw......
A simple line drawing i have implemented:
qreal x,y,w,h;
myscene->sceneRect().getRect(&x,&y,&w,&h);
painter.setPen(Qt::black);
painter.drawLine(x,y,w/2,h/2);
}
void myview::paintEvent(QPaintEvent* event){
qreal x,y,w,h;
myscene->sceneRect().getRect(&x,&y,&w,&h);
QPainter painter(this);
painter.setPen(Qt::black);
painter.drawLine(x,y,w/2,h/2);
QGraphicsView::paintEvent(event);
}
To copy to clipboard, switch view to plain text mode
Bookmarks