您的当前位置:首页正文

获取子对象列表 进行筛选 特定操作 Qt C++

2024-11-20 来源:个人技术集锦
QObjectList objList = this->children();
        for (int i = 0; i < objList.size(); i++){
            const QMetaObject *meta = objList.at(i)->metaObject();
            QString className = QString(meta->className());
            if (className == "QToolBar"){
                QToolBar *toolBar = qobject_cast<QToolBar*> (objList.at(i));
                QString str = toolBar->objectName();
Top