You need to cast the pointer to the correct type, recommended ways are: dynamic_cast or (because you have a QObject) qobject_cast [qt-project.org]:
Champions* item2 = qobject_cast<Champions*>(datalist.at(2));
if(item2)
item2->name();
Thanks a lot ! It works well for me !
↧