PDA

View Full Version : Problem with drawing text



shivendra46d
4th March 2014, 11:15
I am trying to draw text and m using the following code

QPainter paint(this);
QPen pen(QColor::QColor(255,128,00,255));
paint.setPen(pen);


paint.setViewport(0,0,widget_width,widget_height);
paint.scale(1,-1);
paint.setWindow(-widget_width /2,-widget_height/2,widget_width,widget_height);




paint.drawText(QRectF(100,75,100,75),"Hello Qt");

but problem is that when i am doing it it is drawing it up side down how can i draw it properly

wysota
4th March 2014, 11:35
You are scaling the painter's y axis by -1 thus the text is drawn upside-down.