Hi I am trying to add list of QGraphicsItem into QGraphicsScene by this code...
Qt Code:
  1. int position=0;
  2. int numberOfCards=xAxe*yAxe;
  3. for (qreal i=0; i<xAxe*myWidthCard; i+=myWidthCard){
  4. for (qreal j=0; j<yAxe*myHeightCard; j+=myHeightCard){
  5. Item *item=list[position];
  6. item->setPos(item->pos().x()+i, item->pos().y()+j);
  7. outputScene->addItem(item);
  8. position++;
  9. }
  10. }
To copy to clipboard, switch view to plain text mode 
Could someone help me, why this code dont add item to Scene?


I dont want to use "foreach"

this code is OK
Qt Code:
  1. foreach (Item *listItem, list) {
  2. listItem->setPos(listItem->pos().x()+x, listItem->pos().y()+y);
  3. outputScene->addItem(listItem);
  4. x+=myWidthCard; j++;
  5. if(j==xAxe){
  6. y+=myHeightCard; x=0; j=0; i++;
  7. }
  8. if(i==yAxe){
  9. y=0; i=0;
  10. }
  11. }
To copy to clipboard, switch view to plain text mode 
thanks for answers