Draw text on image using Qt
Solved
General and Desktop
-
I want to draw text on an image. I use this code, but I do not see any text on the image.
ImageSaver::ImageSaver(QObject *parent) : QObject(parent) { } void ImageSaver::save(const QString &path) const { img_.save(path); QImage image(path); QPainter p(&image); p.setPen(QPen(Qt::red)); p.setFont(QFont("Times", 12, QFont::Bold)); p.drawText(image.rect(), Qt::AlignCenter, "Text"); }