You just need to setup your pixmap before you assign the painter:

Qt Code:
  1. #include <QtCore>
  2. #include <QtGui>
  3.  
  4. int main(int argc, char *argv[])
  5. {
  6. QApplication a(argc, argv);
  7.  
  8. QLabel l;
  9.  
  10. QPixmap pixmap;
  11. pixmap.load(QString::fromUtf8("E:/2010-02-25_112406.png"));
  12.  
  13. QPainter painter(&pixmap);
  14. QPen Red((QColor::QColor(255,0,0)),1);
  15. painter.setPen(Red);
  16. painter.drawLine(50,50,250,250);
  17. l.setPixmap(pixmap);
  18. l.show();
  19.  
  20. return a.exec();
  21. }
To copy to clipboard, switch view to plain text mode 

Joh