I have created a class Atom
that extends the Qt class QGraphicsItem
like this:
Atom::Atom(qreal rad, qreal mass, int element, int state) : QGraphicsItem()
{
// Initialization code
}
void Atom::changeState(int newState)
{
// Code...
}
Then, I add my atom to the scene like this:
Atom *a=new Atom(rad,mass,element,state);
a->setPos(pos);
scene->addItem(a);
However, Qt converts my Atom class to a QGraphicsItem class. Now, when I call scene->items()
, I get a QList of QGraphicsItems, which do not have the properties and methods of my Atom class.
So, I am asking the question: How would I go about getting a list of the Atoms that I have added to my QGraphicsScene?
Thanks.