PDA

View Full Version : Getting the right painter inside QGraphicsView paintevent



tonnot
1st December 2011, 11:37
How can I get the right tranformed Painter of my GraphicsView extended class ?
To draw a temporal item not added to the scene, I have to write :


A_Gview2D::paintEvent(QPaintEvent *event) {
QPainter painter(this->viewport()); // this is the 'widget' `painter

QTransform AFT=QTransform(this->matrix());
AFT.translate(w_temp_item->pos().x(),w_temp_item->pos().y() );
painter.setTransform(AFT);

Is any other way to get the right painter ?
Any idea ? Thanks