How to create a container with reference objects in Qt?
Solved
General and Desktop
-
wrote on 5 Sept 2019, 17:36 last edited by
Good afternoon.
Made this vector:QVector <MoveItem> vectorMoveItem;
Separately create objects of the class:
MoveItem *item = new MoveItem(); // Create a graphic element
In vector vector Move Item to record the item objects?
It doesn't work:vectorMoveItem.append(*item);
-
Store pointers, not objects
-
wrote on 5 Sept 2019, 17:53 last edited by
It's work
QVector <MoveItem *> vectorMoveItem;
But how to address the element of the vector?
It doesn't work:vectorMoveItem[3]
-
Hi,
Did you put enough elements in this vector ?
1/4