you can use
const QObjectList & QObject::children ()
which returns list of objects and the you can use dynamic cast to identify the item. //you can use objectName() also for identifying particular object
ex:
foreach
(QObject obj, parent.
children(){
if(pb){
//you have handle
}
//if you already set object name like obj.setObjectName(QString("my pushButton"));
if(QString("my pushButton") == obj.
objectName()){ //you have handle
}
}
foreach(QObject obj, parent.children()
{
QPushButton* pb = dynamic_cast<QPushButton*> (obj);
if(pb){
//you have handle
}
//if you already set object name like obj.setObjectName(QString("my pushButton"));
if(QString("my pushButton") == obj.objectName()){
//you have handle
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks