I have a QList for store some item on QgraphicsScene like:
QList<QGraphicsItem*> lineList;
when I want to use it like:
lineList[itemIndex++]=scene->createItemGroup(groupItems);
i got a runtime error. I'm curios why?
by the way I know about linelist.append()
thanks.
Assuming that you want to create a new QList, you should use
QList::append() or << operator
. From Qt Docs:So
QList::operator[]
can't be used to populate list like that.