Hi to all!

With the following code I want to put some pictures on a scene:
Qt Code:
  1. #include "CMerchandizeSelector.h"
  2.  
  3. CMerchandizeSelector::CMerchandizeSelector(QWidget* pParent)
  4. {
  5. QGraphicsScene* pScene=new QGraphicsScene(this); // creates new scene
  6. Q_CHECK_PTR(pScene); // checks object creation
  7. pScene->setItemIndexMethod(QGraphicsScene::NoIndex);
  8. setSceneRect(minX, minY, maxX, maxY);
  9. setScene(pScene);
  10. setWindowTitle(trUtf8("Merchandize selector"));
  11. // TODO: sets scene widget flags so it cannot be closed
  12. /*
  13.   m_pIconList=new QStringList; // creates new string list for storing icon names
  14.   Q_CHECK_PTR(m_pIconList); // checks creation
  15. */
  16.  
  17. m_cPixmap=QPixmap(100, 100);
  18. m_cPixmap.fill(Qt::black);
  19.  
  20. QPainter p(&m_cPixmap); // painter
  21. //QPainter p(this); // painter
  22. p.translate(rCenterX, rCenterY); // translated coordinate system to centre of widget
  23. p.setWindow(QRect(minX, minY, maxX, maxY));
  24. p.setViewport(QRect(minX, minY, maxX, maxY));
  25.  
  26. // only for test purposes, images must be read from database
  27. m_cImageList.append(QImage(":/images/apple_cake.png"));
  28. m_cImageList.append(QImage(":/images/bigmac.png"));
  29. m_cImageList.append(QImage(":/images/applejuice.png"));
  30. m_cImageList.append(QImage(":/images/cafe_cool"));
  31. m_cImageList.append(QImage(":/images/chesseburger.png"));
  32. m_cImageList.append(QImage(":/images/coke.png"));
  33.  
  34. // computes positions for images
  35. for (m_iCounter=0; m_iCounter<iLoadTreshold; m_iCounter++)
  36. {
  37. QPointF tmpPoint=computePoint(0, 0, rCircleRadius, m_iCounter*rAngle*Pi/180);
  38. m_cImagePointList.append(tmpPoint);
  39. qDebug() << "(" << tmpPoint.rx() << ", " << tmpPoint.ry() << "); ";
  40. }
  41.  
  42. // draws an image at computed coords
  43. for (m_iCounter=0; m_iCounter<m_cImageList.count(); m_iCounter++)
  44. {
  45. p.drawImage(m_cImagePointList.at(m_iCounter), m_cImageList.at(m_iCounter));
  46. //p.drawImage(QPointF(80*m_iCounter, 0), m_cImageList.at(m_iCounter));
  47. }
  48. }
  49.  
  50. CMerchandizeSelector::~CMerchandizeSelector()
  51. {
  52. }
  53.  
  54. // computes cartesian coordinates for given circle and its angle
  55. QPointF CMerchandizeSelector::computePoint(qreal rOriginX, qreal rOriginY, qreal rRadius, qreal rAngle)
  56. {
  57. QPointF p; // point
  58. p.setX(rOriginX+rRadius*cos(rAngle*Pi/180)); // computes x
  59. p.setY(rOriginX+rRadius*sin(rAngle*Pi/180)); // computes y
  60. //p.setX(rOriginX+rRadius*cos(rAngle)); // computes x
  61. //p.setY(rOriginX+rRadius*sin(rAngle)); // computes y
  62. return p; // returns p
  63. }
  64.  
  65. // painter event
  66. /*
  67. void CMerchandizeSelector::paintEvent(QPaintEvent *e)
  68. {
  69.   QPainter p(this);
  70.   p.setClipRect(e->rect());
  71.   p.drawTiledPixmap(rect(), m_cPixmap);
  72.  
  73.   for (m_iCounter=0; m_iCounter<m_cImageList.count(); m_iCounter++)
  74.   {
  75.   //p.drawImage(m_cImagePointList.at(m_iCounter), m_cImageList.at(m_iCounter));
  76.   p.drawImage(QPointF(80*m_iCounter, 0), m_cImageList.at(m_iCounter));
  77.   }
  78. }
  79. */
To copy to clipboard, switch view to plain text mode 
Here is header file:
Qt Code:
  1. #ifndef CMERCHANDIZESELECTOR_H_
  2. #define CMERCHANDIZESELECTOR_H_
  3.  
  4. // qt includes
  5. #include <QtGui/QGraphicsView>
  6. //#include <QtGui/QGraphicsScene>
  7. //#include <QtGui/QGraphicsItem>
  8. #include <QtGui/QImage>
  9. //#include <QtCore/QPointer>
  10. //#include <QtCore/QStringList>
  11. #include <QtCore/QPointF>
  12. #include <QtCore/QRect>
  13. //#include <QtCore/QRectF>
  14. #include <QtGui/QPainter>
  15. #include <QtGui/QPixmap>
  16. #include <QtGui/QPaintEvent>
  17. #include <QtDebug>
  18.  
  19. // math support includes
  20. #include <cmath>
  21.  
  22. // custom includes
  23. #include "globals.h"
  24.  
  25. class CMerchandizeSelector : public QGraphicsView
  26. {
  27. Q_OBJECT
  28.  
  29. public:
  30. CMerchandizeSelector(QWidget* pParent=0);
  31. virtual ~CMerchandizeSelector();
  32.  
  33. private:
  34. QList<QImage> m_cImageList; // list of icon filenames on 3d graphics browse
  35. QList<QPointF> m_cImagePointList; // list of coordinates for icons
  36. quint16 m_iCounter; // protected loop counter
  37. QPixmap m_cPixmap; // pixmap
  38. //QPointer <CLens> m_pLens; // lens for zoming selected merchandize
  39. //QStringList m_pIconList; // list of icon filenames on 3d graphics browse
  40. /*
  41.   void keyPressEvent(QKeyEvent *event);
  42.   void timerEvent(QTimerEvent *event);
  43.   void wheelEvent(QWheelEvent *event);
  44.   void drawBackground(QPainter *painter, const QRectF &rect);
  45. */
  46. //void paintEvent(QPaintEvent *e); // painter event
  47. QPointF computePoint(qreal rOriginX, qreal rOriginY, qreal rRadius, qreal rAngle);
  48. };
  49.  
  50. #endif /*CMERCHANDIZESELECTOR_H_*/
To copy to clipboard, switch view to plain text mode 
And here are constants, used in app (file globals.h):
Qt Code:
  1. // globals.h
  2.  
  3. #ifndef GLOBALS_H
  4. #define GLOBALS_H
  5.  
  6. // qt includes
  7. #include <QtGlobal>
  8.  
  9. // scene rect coords
  10. static const qint16 minX=0;
  11. static const qint16 minY=0;
  12. static const qint16 maxX=600; // scene width
  13. static const qint16 maxY=600; // scene height
  14.  
  15. //static const qreal rCenterX=(maxX+minX)/2; // scente centre x
  16. static const qreal rCenterX=(maxX-minX)/2; // scente centre x
  17. //static const qreal rCenterY=(maxY+minY)/2; // scente centre x
  18. static const qreal rCenterY=(maxY-minY)/2; // scente centre x
  19. static const qreal rCirleMargin=20.0; // circle margin
  20. static const qreal rCircleRadius=maxX-rCenterX-rCirleMargin; // radius of circle
  21.  
  22. // geometric constants
  23. static const qreal pi=3.14159265358979323846264338327950288419716939937510; // pi constant
  24. static const qreal Pi=pi; // alias for pi
  25. static const quint8 iLoadTreshold=10; // icon load treshold
  26. static const qreal rEmtpyCircle=0; // emtpy circle
  27. static const qreal rFullCircle=360; // full circle has 360 degrees
  28. static const qreal rAngle=rFullCircle/iLoadTreshold; // merchandize icon appears every rAngle degrees on rotary
  29. // merchandize selector
  30.  
  31. #endif
To copy to clipboard, switch view to plain text mode 
Can anyone help me please why pictures are not shown?! I read the docs about qt's coordinate system, but I simply do not get it how it works!!!!

Please help!