Is this your real code? The argument you pass in to MyTimer:: mySlot() is named "_CurrentBuilder", not "CurrentBuilder", so you are not modifying the same QVector as the one you passed as an argument.CurrentBuilder.removeFirst();
Is this your real code? The argument you pass in to MyTimer:: mySlot() is named "_CurrentBuilder", not "CurrentBuilder", so you are not modifying the same QVector as the one you passed as an argument.CurrentBuilder.removeFirst();
<=== The Great Pumpkin says ===>
Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.
Im sorry about the quality of the code, I was changing bit values its true it was first as you described but the animation doesn't start, it does only when I use the private CurrentBuilder but it saves the older spheres created
in the constructor I assign the _CurrentBuilder passed in the arguments to the private attribute of the class
You are also passing in the _CurrentBuilder QVector -by value-, which means it is making a copy of the argument you call it with. So the QVector you are modifying is the copy, not the original. If you want to avoid this, call it with QVector<> & _CurrentBuilder.
<=== The Great Pumpkin says ===>
Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.
I fixed to use the reference instead of the copy but the problem persists, I think it is the way I show the spheres that causes the problem, each time it passes the QEntity(with all the spheres included) to the rootEntity
it draws them and then it adds another one while timeout is happening, but this logically would save the older spheres and this is what happens, if anyone has an idea how I can remove old QEntities from the rootEntity probably that would solve the issue
I think you can just call deleteLater() on the entity pointer. From what I can read of the QNode / QEntity documentation, there are no explicit methods to remove child nodes, but since QNode inherits from QObject, it has the same behavior - simply delete the child and the QObject parent - child relationship takes care of the cleanup. Use deleteLater(), not delete() so that QObject can perform a proper cleanup (and so your program doesn't crash because the pointer has been deleted before Qt has cleaned up references to it).if anyone has an idea how I can remove old QEntities from the rootEntity probably that would solve the issue
If you are having a problem with identifying the spheres you want to delete, then you probably need to keep an extra data structure that stores them when you create them.
<=== The Great Pumpkin says ===>
Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.
Bookmarks