Is there a similar procedure in c++ to the java "instanceof"??
I would like to tell apart from the QObject::childs() list which widgets subclass a common base class i created for my subclassed widgets, but I haven't succeeded yet, the code I'm using right now is :
void fetchChildData
(QObject* vent
){ QObjectList childs = vent->children();
for(int i = 0 ; i < childs.size() ; i++){
displayWidget* dW = dynamic_cast<displayWidget*>(childs[i]);
if(dW!=0){
dW->fetchData();
}
fetchChildData(childs[i]);
}
}
void fetchChildData(QObject* vent){
QObjectList childs = vent->children();
for(int i = 0 ; i < childs.size() ; i++){
displayWidget* dW = dynamic_cast<displayWidget*>(childs[i]);
if(dW!=0){
dW->fetchData();
}
fetchChildData(childs[i]);
}
}
To copy to clipboard, switch view to plain text mode
But it won't make the trick,... Any help would be really appreciated.
Bookmarks