Okay, so I'm looking for a barebone example of how to draw an image at a given position in graphicsView. I've tried to study the Canvas and AsteroidsPort examples to get an idea of what's going on, but it seems they're adding complexity that I won't need and I'm having trouble deciphering the necessary from the unnecessarily complex parts.

Basically, I started out with a rectangle drawing code to get an idea of what's going on.

Qt Code:
  1. int main( int argc, char **argv )
  2. {
  3.  
  4. QApplication app(argc, argv);
  5.  
  6. scene.setSceneRect( -100.0, -100.0, 200.0, 200.0 );
  7.  
  8. QGraphicsEllipseItem *item = new QGraphicsEllipseItem( 0, &scene );
  9. item->setRect( -50.0, -50.0, 50, 100.0 );
  10.  
  11. scene.addItem(myI);
  12. QGraphicsView view( &scene );
  13. view.setRenderHints( QPainter::Antialiasing );
  14. view.show();
  15.  
  16. return app.exec();
  17. }
To copy to clipboard, switch view to plain text mode 

This worked great and all and I think I got an idea of what's going on. You create a generic graphics item, add the graphics item to the scene, set the QGraphicsView to what the scene has and then show it.

So using this, I created a the following code to display an image.

Qt Code:
  1. #include <QApplication>
  2. #include <QGraphicsEllipseItem>
  3. #include <QGraphicsScene>
  4. #include <QGraphicsView>
  5.  
  6. QString myImgName = "myimg.png";
  7. static QImage *myImg;
  8.  
  9. int main( int argc, char **argv )
  10. {
  11.  
  12. QApplication app(argc, argv);
  13.  
  14. scene.setSceneRect( -100.0, -100.0, 200.0, 200.0 );
  15.  
  16. myImg = new QImage;
  17. myImg->load(myImgName);
  18.  
  19.  
  20. QPixmap pix;
  21. pix.fromImage( *myImg, Qt::AutoColor );
  22.  
  23. myI->setPixmap(pix);
  24.  
  25.  
  26. scene.addItem(myI);
  27. myI->setPos(50, 50);
  28. myI->setZValue(50);
  29.  
  30.  
  31. QGraphicsView view( &scene );
  32. view.setRenderHints( QPainter::Antialiasing );
  33. view.show();
  34.  
  35. return app.exec();
  36. }
To copy to clipboard, switch view to plain text mode 

So instead of a rectangle item, I have to create a QGraphicsPixmapItem for pictures. To load the picture, I apparently had to create a QImage and then use the loading function, and then get the pix from that. I add it to the scene, set position, let the scene be viewed from the QGraphicsView and Voila! Nothing but empty whiteness. Where's my image?

Can anyone spot what might be so incredibly wrong with my code? I think I made sure the image was in the right directory, so I doubt it's not finding the picture.