[Interest] draw text and shape on an image using QGraphicsView
Arun Kumar
arunkumaraymuo at gmail.com
Sun Jul 15 16:14:46 CEST 2012
Hello,
I am trying to create a simple image editing tool using Qt GraphocsView
I can load any image file to QGraphicsView
now I am trying to add some text in loaded image. For that I subclass
QGraphicsView and override
mousePressEvent(QMouseEvent* event)
I tried this code to draw a string on the clicked position of image
but it not displaying any string in image
void GraphicsViewExt::mousePressEvent(QMouseEvent* event) {
//For panning the view
LastPanPoint = event->pos();
QPainter painter(this->scene());
painter.setRenderHint(QPainter::Antialiasing);
// this->scene()->render(&painter);
painter.drawText(LastPanPoint.x(),LastPanPoint.y(),"Test String");
//this->invalidateScene();
}
How I can draw a string on an image when the user click on the image.
I searched net but didnt get any solution to this simple problem?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120715/1cdcbe66/attachment.html>
More information about the Interest
mailing list