hell guys,
If i draw a rect using painter ... how can mirror it using the the origin point. ????
thanks
Printable View
hell guys,
If i draw a rect using painter ... how can mirror it using the the origin point. ????
thanks
QPainter::scale() with a negative scale factor works (if I understood your question):
Code:
{ Q_OBJECT public: resize(640, 480); } // for a bit of colour linearGradient.setColorAt(0.0, Qt::white); linearGradient.setColorAt(0.2, Qt::green); linearGradient.setColorAt(1.0, Qt::black); p.translate(320, 0); // put x origin in centre p.setBrush(linearGradient); p.drawRect(r); p.setPen(Qt::red); p.scale(-1.0, 1.0); p.drawRect(r); } };
Great this exactly what i mean.
but now i faced other problem ... I have text along the rect sides (bottom and left) when i flip the text show flipped as well, is there a way where i can make the Text show correctly but still in the direction of the painter ?
Thank you so much
Added after 44 minutes:
I tried to use
p->setLayoutDirection(Qt::RightToLeft);
but it didn't work, it didn't show any affect actually.
You need to calculate where the text should go and then QPainter::translate() QPainter::drawText() it yourself.