You just need to setup your pixmap before you assign the painter:
#include <QtCore>
#include <QtGui>
int main(int argc, char *argv[])
{
pixmap.
load(QString::fromUtf8("E:/2010-02-25_112406.png"));
painter.setPen(Red);
painter.drawLine(50,50,250,250);
l.setPixmap(pixmap);
l.show();
return a.exec();
}
#include <QtCore>
#include <QtGui>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QLabel l;
QPixmap pixmap;
pixmap.load(QString::fromUtf8("E:/2010-02-25_112406.png"));
QPainter painter(&pixmap);
QPen Red((QColor::QColor(255,0,0)),1);
painter.setPen(Red);
painter.drawLine(50,50,250,250);
l.setPixmap(pixmap);
l.show();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
Joh
Bookmarks