#include "AnalysisPanelWidget.h" #include "AnalysisTableWidget.h" #include "dbService/DBServiceSet.h" #include "dbService/NodeMatrixService.h" #include "dbService/DemandWeightService.h" #include "ui_AnalysisPanelWidget.h" #include #include AnalysisPanelWidget::AnalysisPanelWidget(QWidget *parent) : QWidget(parent), ui(new Ui::AnalysisPanelWidget) { ui->setupUi(this); firstLayout = new QGridLayout; firstPlainWidget = nullptr; ui->stackedWidget->widget(0)->setLayout(firstLayout); secondLayout = new QGridLayout; secondPlainWidget = nullptr; ui->stackedWidget->widget(1)->setLayout(secondLayout); ui->stackedWidget->setCurrentIndex(0); } AnalysisPanelWidget::~AnalysisPanelWidget() { if (currentMindNodes) { delete currentMindNodes; } if (classifiedNodes) { delete classifiedNodes; } if (indexsRefClassifiedNodes) { delete indexsRefClassifiedNodes; } delete ui; } void AnalysisPanelWidget::init(const QStringList indexsRef, const QStringList indexs, int engineerId, int expertId) { // qDebug() << "AnalysisPanelWidget::init" << indexsRef << indexs << // engineerId << expertId; indexsRefClassifiedNodes = nullptr; if (!indexsRef.isEmpty()) { MindNodeManager *indexsRefNodes = new MindNodeManager(); // 是否参考指标体系 getMindNodes(indexsRefNodes, indexsRef); indexsRefClassifiedNodes = new QList>; sortMindNodes(*indexsRefNodes, indexsRefClassifiedNodes); delete indexsRefNodes; } else { indexsRefClassifiedNodes = nullptr; } if (!indexs.isEmpty()) { currentMindNodes = new MindNodeManager(); classifiedNodes = new QList>; getMindNodes(currentMindNodes, indexs); sortMindNodes(*currentMindNodes, classifiedNodes); } else { currentMindNodes = nullptr; classifiedNodes = nullptr; } ui->toatalPagesLabel->setText(QString("共%1页").arg(getPages())); ui->currPageLabel->setText(QString("当前第0页")); initPlainWidget(engineerId, expertId, m_table_msg); setPage(1); } // 综合专家页面初始化 void AnalysisPanelWidget::initComposite(const QStringList indexsRef, const QStringList indexs, int engineerId, QList expertIds) { indexsRefClassifiedNodes = nullptr; if (!indexsRef.isEmpty()) { MindNodeManager *indexsRefNodes = new MindNodeManager(); // 是否参考指标体系 getMindNodes(indexsRefNodes, indexsRef); indexsRefClassifiedNodes = new QList>; sortMindNodes(*indexsRefNodes, indexsRefClassifiedNodes); delete indexsRefNodes; } else { indexsRefClassifiedNodes = nullptr; } if (!indexs.isEmpty()) { currentMindNodes = new MindNodeManager(); classifiedNodes = new QList>; getMindNodes(currentMindNodes, indexs); sortMindNodes(*currentMindNodes, classifiedNodes); } else { currentMindNodes = nullptr; classifiedNodes = nullptr; } ui->toatalPagesLabel->setText(QString("共%1页").arg(getPages())); ui->currPageLabel->setText(QString("当前第0页")); initCompositePlainWidget(engineerId, expertIds, m_table_msg); setPage(1); } void AnalysisPanelWidget::setViewTypeAndTableMsg(int type, QString tableMsg) { analysisViewType = type; m_table_msg = tableMsg; if (type == 1) { ui->prePageBtn->setText("上一级指标"); ui->nextPageBtn->setText("下一级指标"); } else if (type == 2) { ui->prePageBtn->setText("上一级技术措施"); ui->nextPageBtn->setText("下一级技术措施"); } else if (type == 3) { ui->prePageBtn->setText("上一级指标"); ui->nextPageBtn->setText("下一级指标"); } } void AnalysisPanelWidget::setArithmeticMethod(QString resultMethod, QString matricesMethod) { m_resultMethod = resultMethod; m_matricesMethod = matricesMethod; } void AnalysisPanelWidget::sortMindNodes(const MindNodeManager &manager, QList> *classify) { for (MindNodeManager::NodeMessage msg : manager.getMindNodes()) { QStringList nodePonit = msg.node.split("."); // qDebug() << "TAG" << nodePonit << msg.node << msg.name; while (nodePonit.count() - 1 > classify->count()) { (*classify) << QList(); } (*classify)[nodePonit.count() - 2] << msg; } #if 0 struct ClassifyNode { MindNodeManager::NodeMessage msg; QList child; }; QList classifyList; for (MindNodeManager::NodeMessage msg : manager.getMindNodes()) { QStringList nodePonit = msg.node.split("."); int level = nodePonit.count() - 1; if (level == 1) { //第一级 ClassifyNode *cn = new ClassifyNode; cn->msg = msg; classifyList << cn; } else { ClassifyNode *ref = classifyList[nodePonit[1].toInt() - 1]; for (int i = 2; i < level; ++i) { ref = ref->child[nodePonit[i].toInt() - 1]; } ClassifyNode *cn = new ClassifyNode; cn->msg = msg; ref->child << cn; } } #endif } void AnalysisPanelWidget::getMindNodes(MindNodeManager *manager, QStringList listNodes) { int sn[16]; memset(sn, 0, sizeof(int) * 16); int spaceNum = -1; int level = 0; MindNodeManager::NodeMessage temp; manager->setMindName(listNodes[0].trimmed()); for (int i = 1; i < listNodes.count(); i++) { int tempSpace = 0; for (QString s : listNodes[i]) { if (s == " ") { tempSpace++; } else { break; } } tempSpace /= 4; if (tempSpace == 1) { // 一级 spaceNum = tempSpace; level = 0; sn[level]++; memset((void *)&sn[1], 0, sizeof(int) * 15); } else { if (spaceNum < tempSpace) { // 空格增加 spaceNum = tempSpace; level++; sn[level]++; } else if (spaceNum == tempSpace) { // 同一级 sn[level]++; } else { memset((void *)&sn[tempSpace], 0, sizeof(int) * (16 - tempSpace)); level -= spaceNum - tempSpace; spaceNum = tempSpace; sn[level]++; } } QString node = "1"; for (int l : sn) { if (l > 0) { node += QString(".%1").arg(l); } else { break; } } if (listNodes[i].trimmed().isEmpty()) { temp.name = QString("NULL(节点%1)").arg(node); temp.node = node; temp.remark = ""; manager->pushNewMind(temp); } else { temp.name = listNodes[i].trimmed().split("\t")[0]; temp.node = node; temp.remark = listNodes[i].trimmed().split("\t")[1]; manager->pushNewMind(temp); } } } QStringList AnalysisPanelWidget::getFirstIndexNodes(const MindNodeManager &manager) { QList> classify; for (MindNodeManager::NodeMessage msg : manager.getMindNodes()) { QStringList nodePonit = msg.node.split("."); while (nodePonit.count() - 1 > classify.count()) { classify << QList(); } classify[nodePonit.count() - 2] << msg; } QStringList firstNodes; for (MindNodeManager::NodeMessage msg : classify.first()) { firstNodes << msg.name; } return firstNodes; } QStringList AnalysisPanelWidget::getLastIndexNodes(const MindNodeManager &manager) { QList> classify; for (MindNodeManager::NodeMessage msg : manager.getMindNodes()) { QStringList nodePonit = msg.node.split("."); while (nodePonit.count() - 1 > classify.count()) { classify << QList(); } classify[nodePonit.count() - 2] << msg; } QStringList lastNodes; for (MindNodeManager::NodeMessage msg : classify.last()) { lastNodes << msg.name; } return lastNodes; } int AnalysisPanelWidget::getPages() { #if 0 int max = 0; for (MindNodeManager::NodeMessage msg : currentMindNodes->getMindNodes()) { QStringList nodePonit = msg.node.split("."); if (max < nodePonit.count() - 1) { max = nodePonit.count() - 1; } } return max; #else if (!classifiedNodes) { return 0; } return classifiedNodes->count(); #endif } void AnalysisPanelWidget::setPage(int page) { if (page < 1 || page > getPages()) { return; } currentPage = page; ui->currPageLabel->setText(QString("当前第%1页").arg(currentPage)); if (currentPage == 1) { ui->prePageBtn->setDisabled(true); ui->nextPageBtn->setDisabled(false); } else if (currentPage == getPages()) { ui->prePageBtn->setDisabled(false); ui->nextPageBtn->setDisabled(true); } else { ui->prePageBtn->setDisabled(false); ui->nextPageBtn->setDisabled(false); } paintPlainWidget(); } // 专家初始化数据 void AnalysisPanelWidget::initPlainWidget(int engineerId, int expertId, QString tableMsg) { if (getPages() == 0) { return; } // 获取技术措施指标权重 QList firstDemandList; QList secondDemandList; DemandWeightService().QueryFirstDemandWeightByEngineerId(&firstDemandList, expertId, engineerId, tableMsg); // DBServiceSet().QuerySecondDemandWeightByEngineerId(&secondDemandList, expertId, // engineerId,"能力重要度评估指标体系"); DemandWeightService().QuerySecondDemandWeightByEngineerIdAndMaxPage(&secondDemandList, expertId, engineerId, "能力重要度评估指标体系"); QList nodeValueInfoList; NodeMatrixService().QueryNodeMatrixListByExpertIdAndEngineerId(&nodeValueInfoList, expertId, engineerId, tableMsg); // 准备第一页,非tab的 AnalysisTableWidget *table = new AnalysisTableWidget; table->horizontalHeader()->setStretchLastSection(true); table->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); // 填充表格 table->setTableIndexAndTableMsg(0, engineerId, QString::number(expertId), tableMsg); connect(table, &AnalysisTableWidget::dataReady, this, &AnalysisPanelWidget::oneTableDataReady); connect(table, &AnalysisTableWidget::returnModel, this, &AnalysisPanelWidget::getTableModel); if (indexsRefClassifiedNodes) { for (MindNodeManager::NodeMessage msg : indexsRefClassifiedNodes->last()) { table->addRowNode(msg.node, msg.name, msg.remark); } } for (MindNodeManager::NodeMessage msg : classifiedNodes->first()) { table->addColNode(msg.node, msg.name, msg.remark); if (indexsRefClassifiedNodes == nullptr) { table->addRowNode(msg.node, msg.name, msg.remark); } } table->setTableWeight(firstDemandList, secondDemandList); QVector firstTableWieghts; table->paintMatrixTable(nodeValueInfoList, analysisViewType); firstLayout->addWidget(table); // 准备第二页,tab组合的 QTabWidget *tab = new QTabWidget; for (int p = 1; p < getPages(); ++p) { QTabWidget *tab = new QTabWidget; tab->setTabPosition(QTabWidget::South); int index = 0; for (MindNodeManager::NodeMessage msg : classifiedNodes->at(p - 1)) { ++index; QString node = msg.node; // MatrixTableWidget *table = nullptr; table = nullptr; for (MindNodeManager::NodeMessage info : classifiedNodes->at(p)) { if ((info.node.count('.') == msg.node.count('.') + 1) && (info.node.left(msg.node.count()) == msg.node)) { if (!table) { table = new AnalysisTableWidget; connect(table, &AnalysisTableWidget::returnModel, this, &AnalysisPanelWidget::getTableModel); } if (table) { table->addColNode(info.node, info.name, info.remark); if (!indexsRefClassifiedNodes) { table->addRowNode(info.node, info.name, info.remark); } } } } if (indexsRefClassifiedNodes) { for (MindNodeManager::NodeMessage msg : indexsRefClassifiedNodes->last()) { table->addRowNode(msg.node, msg.name, msg.remark); } } if (table) { firstDemandList.clear(); if (firstDemandList.size() == 0) { DemandWeightService().QueryLastPageDemandWeightByEngineerId( &firstDemandList, QString::number(expertId), engineerId, tableMsg, p - 1); } // qDebug() << p << "=" << p << "===========" << firstDemandList.size(); table->setTableIndexAndTableMsg(index, engineerId, QString::number(expertId), tableMsg); table->setTableWeight(firstDemandList, secondDemandList); table->paintSecondMatrixTable(nodeValueInfoList, p, analysisViewType, index); tab->addTab(table, msg.name); connect(table, &AnalysisTableWidget::dataReady, this, &AnalysisPanelWidget::oneTableDataReady); } } tabWidgets << tab; } qDeleteAll(firstDemandList); qDeleteAll(secondDemandList); // secondLayout->addWidget(tab); } // 综合专家页面渲染 void AnalysisPanelWidget::initCompositePlainWidget(int engineerId, QList expertIds, QString tableMsg) { if (getPages() == 0) { return; } QString experId; for (int i = 0; i < expertIds.size(); i++) { if (experId == nullptr) { experId = QString::number(expertIds.at(i)); } else { experId = experId + "," + QString::number(expertIds.at(i)); } } qDebug() << experId; // 获取技术措施指标权重 QList firstDemandList; QList secondDemandList; DemandWeightService().QueryFirstDemandWeightByEngineerId(&firstDemandList, experId, engineerId, tableMsg); DemandWeightService().QuerySecondDemandWeightByEngineerId(&secondDemandList, experId, engineerId, "能力重要度评估指标体系"); QList compositeNodeValueInfoList; computerCompositeValue(compositeNodeValueInfoList, expertIds, engineerId, tableMsg); // 准备第一页,非tab的 AnalysisTableWidget *table = new AnalysisTableWidget; connect(table, &AnalysisTableWidget::dataReady, this, &AnalysisPanelWidget::oneTableDataReady); connect(table, &AnalysisTableWidget::returnModel, this, &AnalysisPanelWidget::getTableModel); if (indexsRefClassifiedNodes) { for (MindNodeManager::NodeMessage msg : indexsRefClassifiedNodes->last()) { table->addRowNode(msg.node, msg.name, msg.remark); } } for (MindNodeManager::NodeMessage msg : classifiedNodes->first()) { table->addColNode(msg.node, msg.name, msg.remark); if (indexsRefClassifiedNodes == nullptr) { table->addRowNode(msg.node, msg.name, msg.remark); } } table->setTableWeight(firstDemandList, secondDemandList); QVector firstTableWieghts; table->setTableIndexAndTableMsg(0, engineerId, experId, m_table_msg); table->paintMatrixTable(compositeNodeValueInfoList, analysisViewType); firstLayout->addWidget(table); // 准备第二页,tab组合的 for (int p = 1; p < getPages(); ++p) { QTabWidget *tab = new QTabWidget; tab->setTabPosition(QTabWidget::South); int index = 0; for (MindNodeManager::NodeMessage msg : classifiedNodes->at(p - 1)) { ++index; QString node = msg.node; // MatrixTableWidget *table = nullptr; table = nullptr; for (MindNodeManager::NodeMessage info : classifiedNodes->at(p)) { if ((info.node.count('.') == msg.node.count('.') + 1) && (info.node.left(msg.node.count()) == msg.node)) { if (!table) { table = new AnalysisTableWidget; table->setTableIndexAndTableMsg(index, engineerId, experId, tableMsg); connect(table, &AnalysisTableWidget::returnModel, this, &AnalysisPanelWidget::getTableModel); } if (table) { table->addColNode(info.node, info.name, info.remark); if (!indexsRefClassifiedNodes) { table->addRowNode(info.node, info.name, info.remark); } } } } if (indexsRefClassifiedNodes) { for (MindNodeManager::NodeMessage msg : indexsRefClassifiedNodes->last()) { table->addRowNode(msg.node, msg.name, msg.remark); } } if (table) { firstDemandList.clear(); if (firstDemandList.size() == 0) { DemandWeightService().QueryLastPageDemandWeightByEngineerId(&firstDemandList, experId, engineerId, tableMsg, p - 1); } table->setTableWeight(firstDemandList, secondDemandList); table->paintSecondMatrixTable(compositeNodeValueInfoList, p, analysisViewType, index); tab->addTab(table, msg.name); connect(table, &AnalysisTableWidget::dataReady, this, &AnalysisPanelWidget::oneTableDataReady); } } tabWidgets << tab; } qDeleteAll(firstDemandList); } // 综合计算 void AnalysisPanelWidget::computerCompositeValue(QList &compositeNodeValueInfoList, QList expertIds, int engineerId, QString tabMsg) { qDebug() << m_matricesMethod; if (m_matricesMethod == "valueAverage") { // 数值平均 int expertSize = 0; if (tabMsg == "能力重要度评估指标体系" || tabMsg == "方案评估指标体系") { for (int i = 0; i < expertIds.size(); i++) { QList nodeValueInfoList; NodeMatrixService().QueryNodeMatrixListByExpertIdAndEngineerId(&nodeValueInfoList, expertIds.at(i), engineerId, tabMsg); // qDebug() << "nodeValueInfoList.size()==" << nodeValueInfoList.size(); if (nodeValueInfoList.size() == 0) { continue; } expertSize += 1; if (compositeNodeValueInfoList.isEmpty()) { compositeNodeValueInfoList = nodeValueInfoList; } else { for (int i = 0; i < compositeNodeValueInfoList.size(); i++) { NodeMatrixInfo *nodeInfo = compositeNodeValueInfoList.at(i); QStringList list = nodeInfo->nodeValue.split("/"); int numerator; int denominator; if (list.size() == 1) { numerator = list.at(0).toInt() * list.at(0).toInt(); denominator = list.at(0).toInt(); } else { numerator = list.at(0).toInt(); denominator = list.at(1).toInt(); } for (int j = 0; j < nodeValueInfoList.size(); j++) { NodeMatrixInfo *info = nodeValueInfoList.at(j); if (nodeInfo->node == info->node && nodeInfo->abscissa == info->abscissa && nodeInfo->ordinate == info->ordinate) { QStringList list2 = info->nodeValue.split("/"); int numerator2; int denominator2; if (list2.size() == 1) { numerator2 = list2.at(0).toInt() * list2.at(0).toInt(); denominator2 = list2.at(0).toInt(); } else { numerator2 = list2.at(0).toInt(); denominator2 = list2.at(1).toInt(); } numerator = numerator * denominator2 + numerator2 * denominator; denominator *= denominator2; nodeInfo->nodeValue = QString::number(numerator) + "/" + QString::number(denominator); } } } } } // 平均value值 for (int i = 0; i < compositeNodeValueInfoList.size(); i++) { QStringList valueList = compositeNodeValueInfoList.at(i)->nodeValue.split("/"); long int numerator = 1; long int denominator = 1; if (valueList.size() != 1) { denominator = valueList.at(1).toInt(); } numerator = valueList.at(0).toInt(); numerator = numerator * 1; denominator *= expertSize; // qDebug() << "---yuefen前" << numerator << "---" << denominator; yuefen(numerator, denominator); // qDebug() << "---yuefen后" << numerator << "---" << denominator; if (denominator == 1) { compositeNodeValueInfoList.at(i)->nodeValue = QString::number(numerator); } else { compositeNodeValueInfoList.at(i)->nodeValue = QString::number(numerator) + "/" + QString::number(denominator); } } } else if (tabMsg == "技术措施重要度评估对象") { for (int i = 0; i < expertIds.size(); i++) { QList nodeValueInfoList; NodeMatrixService().QueryNodeMatrixListByExpertIdAndEngineerId(&nodeValueInfoList, expertIds.at(i), engineerId, tabMsg); if (nodeValueInfoList.size() == 0) { continue; } expertSize += 1; if (compositeNodeValueInfoList.isEmpty()) { compositeNodeValueInfoList = nodeValueInfoList; } else { for (int i = 0; i < compositeNodeValueInfoList.size(); i++) { NodeMatrixInfo *nodeInfo = compositeNodeValueInfoList.at(i); for (int j = 0; j < nodeValueInfoList.size(); j++) { NodeMatrixInfo *info = nodeValueInfoList.at(j); if (nodeInfo->node == info->node && nodeInfo->abscissa == info->abscissa && nodeInfo->ordinate == info->ordinate) { nodeInfo->nodeValue = QString::number(nodeInfo->nodeValue.toInt() + info->nodeValue.toInt()); } } } } } // 平均value值 for (int i = 0; i < compositeNodeValueInfoList.size(); i++) { QStringList valueList = compositeNodeValueInfoList.at(i)->nodeValue.split("/"); long int numerator = valueList.at(0).toInt(); long int denominator = 1; numerator = numerator * 1; denominator *= expertSize; // qDebug() << "---yuefen前" << numerator << "---" << denominator; yuefen(numerator, denominator); // qDebug() << "---yuefen后" << numerator << "---" << denominator; if (denominator == 1) { compositeNodeValueInfoList.at(i)->nodeValue = QString::number(numerator); } else { compositeNodeValueInfoList.at(i)->nodeValue = QString::number(numerator) + "/" + QString::number(denominator); } } } } else { if (tabMsg == "能力重要度评估指标体系" || tabMsg == "方案评估指标体系") { for (int i = 0; i < expertIds.size(); i++) { QList nodeValueInfoList; NodeMatrixService().QueryNodeMatrixListByExpertIdAndEngineerId(&nodeValueInfoList, expertIds.at(i), engineerId, tabMsg); // qDebug() << "nodeValueInfoList.size()==" << nodeValueInfoList.size(); if (nodeValueInfoList.size() == 0) { continue; } if (compositeNodeValueInfoList.isEmpty()) { compositeNodeValueInfoList = nodeValueInfoList; } else { for (int i = 0; i < compositeNodeValueInfoList.size(); i++) { NodeMatrixInfo *nodeInfo = compositeNodeValueInfoList.at(i); QString compostValue = nodeInfo->nodeValue; QStringList list = compostValue.split("/"); long int numerator; long int denominator; if (list.size() == 1) { numerator = list.at(0).toInt() * list.at(0).toInt(); denominator = list.at(0).toInt(); } else { numerator = list.at(0).toInt(); denominator = list.at(1).toInt(); } for (int j = 0; j < nodeValueInfoList.size(); j++) { NodeMatrixInfo *info = nodeValueInfoList.at(j); if (nodeInfo->node == info->node && nodeInfo->abscissa == info->abscissa && nodeInfo->ordinate == info->ordinate) { QString infoValue = info->nodeValue; QStringList list2 = infoValue.split("/"); int numerator2; int denominator2; if (list2.size() == 1) { numerator2 = list2.at(0).toInt() * list2.at(0).toInt(); denominator2 = list2.at(0).toInt(); } else { numerator2 = list2.at(0).toInt(); denominator2 = list2.at(1).toInt(); } // 等级计算 if (compostValue == infoValue) { nodeInfo->nodeValue = compostValue; numerator = numerator2; denominator = denominator2; continue; } else if (numerator / denominator == 0 && numerator2 / denominator2 == 0) { // 都小于1 numerator = 1; denominator = (denominator + denominator2) / 2; } else if (numerator / denominator == 0 && numerator2 / denominator2 != 0) { numerator = 1 + denominator2; denominator = 2; } else if (numerator / denominator != 0 && numerator2 / denominator2 == 0) { numerator = denominator + 1; denominator = 2; } else if (numerator / denominator != 0 && numerator2 / denominator2 != 0) { numerator = abs((numerator / denominator + numerator2 / denominator2)); denominator = 2; } yuefen(numerator, denominator); if (numerator == denominator) { nodeInfo->nodeValue = "1"; } else { nodeInfo->nodeValue = QString::number(numerator) + "/" + QString::number(denominator); } } } } } } } else if (tabMsg == "技术措施重要度评估对象") { } } } // 字母约分处理 void AnalysisPanelWidget::yuefen(long int &numerator, long int &denominator) { long int a = numerator, b = denominator; long int temp = a % b; while (temp) { a = b; b = temp; temp = a % b; } numerator /= b; denominator /= b; // qDebug() << "yuefen--" << numerator << "---" << denominator; } void AnalysisPanelWidget::paintPlainWidget() { bool firstShow = true; if (getPages() == 0) { return; } if (currentPage > 1) { firstShow = false; } if (firstShow) { ui->stackedWidget->setCurrentIndex(0); } else { QTabWidget *newTab = tabWidgets.at(currentPage - 2); // qDebug() << secondLayout->count(); if (secondLayout->count() == 0) { secondLayout->addWidget(newTab); newTab->show(); } else { QTabWidget *currTab = qobject_cast(secondLayout->itemAt(0)->widget()); if (newTab == currTab) { } else { secondLayout->removeWidget(currTab); currTab->hide(); secondLayout->addWidget(newTab); newTab->show(); } } ui->stackedWidget->setCurrentIndex(1); } } void AnalysisPanelWidget::on_prePageBtn_clicked() { setPage(currentPage - 1); } void AnalysisPanelWidget::on_nextPageBtn_clicked() { setPage(currentPage + 1); } void AnalysisPanelWidget::getTableModel(QStandardItemModel *item) { emit returnModel(item); } void AnalysisPanelWidget::oneTableDataReady(bool status) { if (status) { bool filled = true; AnalysisTableWidget *first = qobject_cast(firstLayout->itemAt(0)->widget()); if (!first->isDataReady()) { filled = false; } for (QTabWidget *tab : tabWidgets) { for (int t = 0; t < tab->count(); ++t) { AnalysisTableWidget *table = qobject_cast(tab->widget(t)); if (!table->isDataReady()) { filled = false; } } } emit dataReady(filled); } else { emit dataReady(false); } }