hi,

my app has some balloons with alphabets A-Z as text. I dont want to repeat the balloon with same character,I retrieved items from scene to QList.after completion of all letters,my app has to halt.but in middle itself it is giving error of Assert failure index out of range.can anyone help in correction of error

my code:
Qt Code:
  1. void GraphicsScene::createBallon(void)
  2. {
  3. QList<QGraphicsItem *>itemno=items();
  4. qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
  5. int random = qrand() % 26;
  6. for(int i=1;i<itemno.size();i++)
  7. {
  8. Ballon *temp=qgraphicsitem_cast<Ballon*>(itemno.at(i));
  9. if(temp->getText()==str[random])
  10. return;
  11. }
  12. Ballon *ball = new Ballon(str[random]);
  13. ball->setPos(500 , 550);
  14. addItem(ball);
  15. if(itemno.size()>26)
  16. interval->stop();
  17. }
To copy to clipboard, switch view to plain text mode