Hey guys,

I was wondering if anyone could help me with a problem regarding to QImage and QGraphicsView. I currently used coding to create the image through QImage from a tutorial on Trolltech. The problem I am having is that I am uncertain if I'm getting the right image displayed since the image is just several dots when I try running the code. Is this incorrect? If it is correct, is there a way to enlarge the pixels shown in the image?

Qt Code:
  1. QImage image(3, 3, QImage::Format_Indexed8);
  2. QRgb value;
  3.  
  4. value = qRgb(122, 163, 39); // 0xff7aa327
  5. image.setColor(0, value);
  6.  
  7. value = qRgb(237, 187, 51); // 0xffedba31
  8. image.setColor(1, value);
  9.  
  10. value = qRgb(189, 149, 39); // 0xffbd9527
  11. image.setColor(2, value);
  12.  
  13. image.setPixel(0, 1, 0);
  14. image.setPixel(1, 0, 0);
  15. image.setPixel(1, 1, 2);
  16. image.setPixel(2, 1, 1);
  17.  
  18. QGraphicsScene *scene = new QGraphicsScene (this);
  19. QPixmap pixmap = QPixmap::fromImage(image);
  20. scene->addPixmap(pixmap);
  21. delete QGraphicsViewscene();
  22. QGraphicsView.setScene(scene);
To copy to clipboard, switch view to plain text mode 

Thanks,
Strateng