#include "upgradeapkdialog.h" #include "tools.h" #include "ui_upgradeapkdialog.h" #include #include #include #include UpgradeApkDialog::UpgradeApkDialog(QWidget *parent) : QDialog(parent) { resize(1280, 720); setWindowState(Qt::WindowMaximized); setSizeGripEnabled(false); setWindowTitle(tr("Upgrade apk")); auto vBox = new QVBoxLayout(this); auto hBox = new QHBoxLayout(); auto pushButtonSelectApk = new QPushButton(tr("Select apk")); pushButtonSelectApk->setMinimumSize(QSize(100, 30)); hBox->addWidget(pushButtonSelectApk); auto label_ApkPath = new QLabel(); label_ApkPath->setMinimumSize(QSize(200, 30)); label_ApkPath->setStyleSheet("background-color: #ffffff;"); label_ApkPath->setFrameShape(QFrame::NoFrame); label_ApkPath->setFrameShadow(QFrame::Plain); label_ApkPath->setScaledContents(false); hBox->addWidget(label_ApkPath); auto pushButtonPublish = new QPushButton(tr("Upgrade")); pushButtonPublish->setMinimumSize(QSize(80, 30)); hBox->addWidget(pushButtonPublish); hBox->addStretch(); auto label_4 = new QLabel(tr("APK:")); hBox->addWidget(label_4); auto comboBoxApk = new QComboBox(); comboBoxApk->setEnabled(true); comboBoxApk->setMinimumSize(QSize(200, 30)); comboBoxApk->setStyleSheet(QString::fromUtf8("background-color: #FFFFFF;")); comboBoxApk->setEditable(false); comboBoxApk->setFrame(false); hBox->addWidget(comboBoxApk); auto lineEditPackageName = new QLineEdit(); lineEditPackageName->setMinimumSize(QSize(120, 30)); lineEditPackageName->setStyleSheet(QString::fromUtf8("background-color: #FFFFFF;")); hBox->addWidget(lineEditPackageName); auto pushButtonUninstall = new QPushButton(tr("Uninstall")); pushButtonUninstall->setMinimumSize(QSize(80, 30)); hBox->addWidget(pushButtonUninstall); auto pushButtonCheckRuningState = new QPushButton(tr("check running state")); pushButtonCheckRuningState->setMinimumSize(QSize(140, 30)); hBox->addWidget(pushButtonCheckRuningState); vBox->addLayout(hBox); hBox = new QHBoxLayout(); auto pushButtonSelectFpga = new QPushButton(tr("Select Fpga")); pushButtonSelectFpga->setMinimumSize(QSize(100, 30)); hBox->addWidget(pushButtonSelectFpga); auto label_FpgaPath = new QLabel(); label_FpgaPath->setMinimumSize(QSize(200, 30)); label_FpgaPath->setStyleSheet("QLabel{background: #fff;}"); hBox->addWidget(label_FpgaPath); auto pushButtonUpgradeFpga = new QPushButton(tr("Upgrade")); pushButtonUpgradeFpga->setMinimumSize(QSize(0, 30)); hBox->addWidget(pushButtonUpgradeFpga); hBox->addStretch(); vBox->addLayout(hBox); hBox = new QHBoxLayout(); auto label = new QLabel(tr("success info")); hBox->addWidget(label); hBox->addStretch(); auto pushButtonRefresh = new QPushButton(tr("Refresh")); pushButtonRefresh->setMinimumSize(QSize(0, 30)); hBox->addWidget(pushButtonRefresh); auto txtSearch = new QLineEdit(); txtSearch->setStyleSheet(QString::fromUtf8("background-color: #FFFFFF;")); txtSearch->setClearButtonEnabled(false); hBox->addWidget(txtSearch, 0, Qt::AlignRight); vBox->addLayout(hBox); wDevicePublishList = new LoQTreeWidget(); vBox->addWidget(wDevicePublishList); hBox = new QHBoxLayout(); hBox->addStretch(); auto pushButtonCancel = new QPushButton(tr("Cancel")); pushButtonCancel->setMinimumSize(QSize(0, 30)); connect(pushButtonCancel, &QPushButton::clicked, this, &UpgradeApkDialog::reject); hBox->addWidget(pushButtonCancel, 0, Qt::AlignRight); vBox->addLayout(hBox); QAction *search = new QAction(txtSearch); search->setIcon(QIcon(":/res/ProgramManager/bnSearch.png")); txtSearch->addAction(search, QLineEdit::LeadingPosition); txtSearch->setClearButtonEnabled(true); txtSearch->setStyleSheet("border: 2px solid #aaaaaa;"); wDevicePublishList->setProperty("ssType", "topList"); pushButtonRefresh->setProperty("ssType", "progManageTool"); pushButtonPublish->setProperty("ssType", "progManageTool"); pushButtonSelectApk->setProperty("ssType", "progManageTool"); pushButtonSelectFpga->setProperty("ssType", "progManageTool"); pushButtonUpgradeFpga->setProperty("ssType", "progManageTool"); pushButtonUninstall->setProperty("ssType", "progManageTool"); pushButtonCheckRuningState->setProperty("ssType", "progManageTool"); pushButtonCancel->setProperty("ssType", "progManageTool"); m_headerItem = new QTreeWidgetItem(); m_headerItem->setTextAlignment(1, Qt::AlignHCenter | Qt::AlignVCenter); for(int i=1; isetTextAlignment(i, Qt::AlignCenter); m_headerItem->setData(ENUM_DEVICE_PUBLISH_HEADE_CHECK, 0, ""); m_headerItem->setData(ENUM_DEVICE_PUBLISH_HEADE_SCREEN_ID, 0, tr("Screen ID")); m_headerItem->setData(ENUM_DEVICE_PUBLISH_HEADE_REMARK_NAME, 0, tr("Remark Name")); m_headerItem->setData(ENUM_DEVICE_PUBLISH_HEADE_ONLINE, 0, tr("Online")); m_headerItem->setData(ENUM_DEVICE_PUBLISH_HEADE_SCREEN_IP, 0, tr("Screen IP")); m_headerItem->setData(ENUM_DEVICE_PUBLISH_HEADE_ENCRYPT,0,tr("Security")); m_headerItem->setData(ENUM_DEVICE_PUBLISH_HEADE_PROGRESS, 0, tr("Progress")); m_headerItem->setData(ENUM_DEVICE_PUBLISH_HEADE_XIXUNPLAYER_VERSION, 0, tr("xixunplayer")); m_headerItem->setData(ENUM_DEVICE_PUBLISH_HEADE_CARDSYSTEM_VERSION,0,tr("cardsystem")); m_headerItem->setData(ENUM_DEVICE_PUBLISH_HEADE_TAXIAPP_VERSION,0,tr("taxiapp")); m_headerItem->setData(ENUM_DEVICE_PUBLISH_HEADE_STARTER_VERSION,0,tr("starter")); m_headerItem->setData(ENUM_DEVICE_PUBLISH_HEADE_CONNECTION_VERSION,0,tr("connection")); m_headerItem->setData(ENUM_DEVICE_PUBLISH_HEADE_DISPLAYER_VERSION,0,tr("displayer")); m_headerItem->setData(ENUM_DEVICE_PUBLISH_HEADE_FPAG_VERSION,0,tr("FPGA")); m_headerItem->setData(ENUM_DEVICE_PUBLISH_HEADE_UPDATE_VERSION,0,tr("update")); m_headerItem->setData(ENUM_DEVICE_PUBLISH_HEADE_REMARKS,0,tr("State")); wDevicePublishList->setHeaderItem(m_headerItem); wDevicePublishList->header()->setSectionResizeMode(ENUM_DEVICE_PUBLISH_HEADE_CHECK, QHeaderView::Fixed); wDevicePublishList->header()->setSectionResizeMode(ENUM_DEVICE_PUBLISH_HEADE_ONLINE, QHeaderView::Fixed); wDevicePublishList->header()->setSectionResizeMode(ENUM_DEVICE_PUBLISH_HEADE_SCREEN_ID, QHeaderView::Fixed); wDevicePublishList->header()->setSectionResizeMode(ENUM_DEVICE_PUBLISH_HEADE_REMARK_NAME, QHeaderView::ResizeToContents); wDevicePublishList->header()->setSectionResizeMode(ENUM_DEVICE_PUBLISH_HEADE_SCREEN_IP, QHeaderView::ResizeToContents); wDevicePublishList->header()->setSectionResizeMode(ENUM_DEVICE_PUBLISH_HEADE_ENCRYPT, QHeaderView::Fixed); wDevicePublishList->header()->setSectionResizeMode(ENUM_DEVICE_PUBLISH_HEADE_PROGRESS, QHeaderView::Fixed); wDevicePublishList->header()->setSectionResizeMode(ENUM_DEVICE_PUBLISH_HEADE_XIXUNPLAYER_VERSION, QHeaderView::Stretch); wDevicePublishList->header()->setSectionResizeMode(ENUM_DEVICE_PUBLISH_HEADE_CARDSYSTEM_VERSION, QHeaderView::Stretch); wDevicePublishList->header()->setSectionResizeMode(ENUM_DEVICE_PUBLISH_HEADE_TAXIAPP_VERSION, QHeaderView::ResizeToContents); wDevicePublishList->header()->setSectionResizeMode(ENUM_DEVICE_PUBLISH_HEADE_STARTER_VERSION, QHeaderView::ResizeToContents); wDevicePublishList->header()->setSectionResizeMode(ENUM_DEVICE_PUBLISH_HEADE_CONNECTION_VERSION, QHeaderView::ResizeToContents); wDevicePublishList->header()->setSectionResizeMode(ENUM_DEVICE_PUBLISH_HEADE_DISPLAYER_VERSION, QHeaderView::ResizeToContents); wDevicePublishList->header()->setSectionResizeMode(ENUM_DEVICE_PUBLISH_HEADE_FPAG_VERSION, QHeaderView::ResizeToContents); wDevicePublishList->header()->setSectionResizeMode(ENUM_DEVICE_PUBLISH_HEADE_UPDATE_VERSION, QHeaderView::ResizeToContents); wDevicePublishList->header()->setSectionResizeMode(ENUM_DEVICE_PUBLISH_HEADE_REMARKS, QHeaderView::Stretch); wDevicePublishList->header()->setStretchLastSection(false); wDevicePublishList->setColumnWidth(ENUM_DEVICE_PUBLISH_HEADE_CHECK, 50); wDevicePublishList->setColumnWidth(ENUM_DEVICE_PUBLISH_HEADE_SCREEN_ID, 120); wDevicePublishList->setColumnWidth(ENUM_DEVICE_PUBLISH_HEADE_ONLINE, 50); wDevicePublishList->setColumnWidth(ENUM_DEVICE_PUBLISH_HEADE_ENCRYPT, 50); wDevicePublishList->setColumnWidth(ENUM_DEVICE_PUBLISH_HEADE_PROGRESS, 100); lineEditPackageName->setVisible(false); comboBoxApk->addItem("com.xixun.xixunplayer"); comboBoxApk->addItem("com.xixun.joey.cardsystem"); comboBoxApk->addItem("com.xixun.joey.systemcore"); comboBoxApk->addItem("net.sysolution.taxiapp"); comboBoxApk->addItem("net.sysolution.starter"); comboBoxApk->addItem("com.xixun.display"); comboBoxApk->addItem("com.xixun.xy.conn"); comboBoxApk->addItem("com.xixun.xy.update"); comboBoxApk->addItem("net.sysolution.basicapp"); comboBoxApk->addItem("PackageName"); comboBoxApk->setCurrentIndex(0); comboBoxApk->setFocus(); pushButtonPublish->setEnabled(false); pushButtonUpgradeFpga->setEnabled(false); connect(pushButtonRefresh, &QPushButton::clicked, this, [this, label] { wDevicePublishList->clear(); wDevicePublishList->onCheckAll(false); int iCount = gDevicePanel->LedCardList.count(); for(int i=0;iLedCardList.at(i)); label->setText(tr("All")+":"+QString::number(iCount)); }); connect(pushButtonPublish, &QPushButton::clicked, this, [this, label_ApkPath] { QString strApkName = label_ApkPath->text(); if(strApkName.length()<3) return; int cnt = wDevicePublishList->topLevelItemCount(); for(int i=0; itopLevelItem(i)->checkState(0) == Qt::Checked) static_cast(wDevicePublishList->topLevelItem(i))->onUpgradeApk(strApkName); }); connect(pushButtonUpgradeFpga, &QPushButton::clicked, this, [this, label_FpgaPath] { QString strFpgaName = label_FpgaPath->text(); if(strFpgaName.length()<3) return; int cnt = wDevicePublishList->topLevelItemCount(); for(int i=0; itopLevelItem(i)->checkState(0) == Qt::Checked) static_cast(wDevicePublishList->topLevelItem(i))->onUpgradeFpga(strFpgaName); }); connect(pushButtonSelectApk,&QPushButton::clicked, this, [this, label_ApkPath, pushButtonPublish] { QString strUpgradeApkFile = QFileDialog::getOpenFileName(this, "Open file", QString(), tr("apk package (*.apk *.zip)")); label_ApkPath->setText(strUpgradeApkFile); pushButtonPublish->setEnabled(QFileInfo::exists(strUpgradeApkFile)); }); connect(pushButtonSelectFpga, &QPushButton::clicked, this, [this, label_FpgaPath, pushButtonUpgradeFpga] { QString m_strUpgradeFpgaFile = QFileDialog::getOpenFileName(this, "Open File", QString(), tr("apk package (*.rpd)")); label_FpgaPath->setText(m_strUpgradeFpgaFile); pushButtonUpgradeFpga->setEnabled(QFileInfo::exists(m_strUpgradeFpgaFile)); }); connect(pushButtonUninstall, &QPushButton::clicked, this, [this, comboBoxApk, lineEditPackageName] { QString strApkName = comboBoxApk->currentText(); if(strApkName=="PackageName") strApkName = lineEditPackageName->text(); int cnt = wDevicePublishList->topLevelItemCount(); for(int i=0; itopLevelItem(i)->checkState(0) == Qt::Checked) static_cast(wDevicePublishList->topLevelItem(i))->onUninstallApk(strApkName); }); connect(pushButtonCheckRuningState, &QPushButton::clicked, this, [this, comboBoxApk, lineEditPackageName] { QString strApkName = comboBoxApk->currentText(); if(strApkName=="PackageName") strApkName= lineEditPackageName->text(); int cnt = wDevicePublishList->topLevelItemCount(); for(int i=0; itopLevelItem(i)->checkState(0) == Qt::Checked) static_cast(wDevicePublishList->topLevelItem(i))->onCheckRuningState(strApkName); }); connect(txtSearch,SIGNAL(textChanged(const QString &)),this,SLOT(FilterProgram(const QString &))); connect(comboBoxApk, (void(QComboBox::*)(int))&QComboBox::currentIndexChanged, this, [comboBoxApk, lineEditPackageName](int) { if(comboBoxApk->currentText()=="PackageName") { lineEditPackageName->setVisible(true); lineEditPackageName->setFocus(); } else lineEditPackageName->setVisible(false); }); int iCount = gDevicePanel->LedCardList.count(); for(int i=0; iLedCardList.at(i)); label->setText(tr("All")+":"+QString::number(iCount)); auto timer = new QTimer(this); connect(timer, &QTimer::timeout, this, [this, label] { int iCount = gDevicePanel->LedCardList.count(); for(int i=0;iLedCardList.at(i)); label->setText(tr("All")+":"+QString::number(iCount)); }); timer->start(500000); } void UpgradeApkDialog::onAddLedCard(LedCard *card) { int iExistFlg=0; int cnt = wDevicePublishList->topLevelItemCount(); for(int i=0; i(wDevicePublishList->topLevelItem(i))->m_pLedCard->m_strCardId; if(strTempCardId == card->m_strCardId) { iExistFlg=1; static_cast(wDevicePublishList->topLevelItem(i))->SetItemParam(card); break; } } if(iExistFlg==0) new wUpgradeApkItem(card, wDevicePublishList, this); } void UpgradeApkDialog::keyPressEvent(QKeyEvent *ev) { if(ev->key() == Qt::Key_F3) { QMessageBox::warning(this, "Tip", tr("The encrypted control card can be upgraded directly")); int cnt = wDevicePublishList->topLevelItemCount(); for(int i=0; i(wDevicePublishList->topLevelItem(i))->SetLockFlagFalse(); } } void UpgradeApkDialog::FilterProgram(const QString &strtemp) { if (strtemp.isEmpty()) //显示全部 { for (int i = 0; i< wDevicePublishList->topLevelItemCount(); ++i) { QTreeWidgetItem* topItem = wDevicePublishList->topLevelItem(i); wDevicePublishList->setRowHidden(i,wDevicePublishList->indexFromItem(topItem->parent()),false); } } else { QList resultList = wDevicePublishList->findItems(strtemp, Qt::MatchContains,ENUM_DEVICE_PUBLISH_HEADE_SCREEN_ID); //搜索结果 if (resultList.size() > 0) { //QMessageBox::warning(this, "Export", QString(resultList.size())); for (int i = 0; i< wDevicePublishList->topLevelItemCount(); ++i) { QTreeWidgetItem* topItem = wDevicePublishList->topLevelItem(i); if (resultList.contains(topItem)) wDevicePublishList->setRowHidden(i,wDevicePublishList->indexFromItem(topItem->parent()),false); //显示匹配的结果 else wDevicePublishList->setRowHidden(i,wDevicePublishList->indexFromItem(topItem->parent()),true); //隐藏不匹配的结果 } } else { QList resultList6 = wDevicePublishList->findItems(strtemp, Qt::MatchContains,ENUM_DEVICE_PUBLISH_HEADE_REMARK_NAME); //搜索结果 if (resultList6.size() > 0) { //QMessageBox::warning(this, "Export", QString(resultList.size())); for (int i = 0; i< wDevicePublishList->topLevelItemCount(); ++i) { QTreeWidgetItem* topItem = wDevicePublishList->topLevelItem(i); if (resultList6.contains(topItem)) wDevicePublishList->setRowHidden(i,wDevicePublishList->indexFromItem(topItem->parent()),false); //显示匹配的结果 else wDevicePublishList->setRowHidden(i,wDevicePublishList->indexFromItem(topItem->parent()),true); //隐藏不匹配的结果 } } else { //QMessageBox::warning(this, "Export", "FilterProgram"); QList resultList1 = wDevicePublishList->findItems(strtemp, Qt::MatchContains,ENUM_DEVICE_PUBLISH_HEADE_XIXUNPLAYER_VERSION); //搜索结果 if (resultList1.size() > 0) { //QMessageBox::warning(this, "Export", QString(resultList.size())); for (int i = 0; i< wDevicePublishList->topLevelItemCount(); ++i) { QTreeWidgetItem* topItem = wDevicePublishList->topLevelItem(i); if (resultList1.contains(topItem)) wDevicePublishList->setRowHidden(i,wDevicePublishList->indexFromItem(topItem->parent()),false); //显示匹配的结果 else wDevicePublishList->setRowHidden(i,wDevicePublishList->indexFromItem(topItem->parent()),true); //隐藏不匹配的结果 } } else { QList resultList2 = wDevicePublishList->findItems(strtemp, Qt::MatchContains,ENUM_DEVICE_PUBLISH_HEADE_SCREEN_IP); //搜索结果 if (resultList2.size() > 0) { //QMessageBox::warning(this, "Export", QString(resultList.size())); for (int i = 0; i< wDevicePublishList->topLevelItemCount(); ++i) { QTreeWidgetItem* topItem = wDevicePublishList->topLevelItem(i); if (resultList2.contains(topItem)) wDevicePublishList->setRowHidden(i,wDevicePublishList->indexFromItem(topItem->parent()),false); //显示匹配的结果 else wDevicePublishList->setRowHidden(i,wDevicePublishList->indexFromItem(topItem->parent()),true); //隐藏不匹配的结果 } } else { QList resultList2 = wDevicePublishList->findItems(strtemp, Qt::MatchContains,ENUM_DEVICE_PUBLISH_HEADE_XIXUNPLAYER_VERSION); //搜索结果 if (resultList2.size() > 0) { //QMessageBox::warning(this, "Export", QString(resultList.size())); for (int i = 0; i< wDevicePublishList->topLevelItemCount(); ++i) { QTreeWidgetItem* topItem = wDevicePublishList->topLevelItem(i); if (resultList2.contains(topItem)) wDevicePublishList->setRowHidden(i,wDevicePublishList->indexFromItem(topItem->parent()),false); //显示匹配的结果 else wDevicePublishList->setRowHidden(i,wDevicePublishList->indexFromItem(topItem->parent()),true); //隐藏不匹配的结果 } } else { QList resultList2 = wDevicePublishList->findItems(strtemp, Qt::MatchContains,ENUM_DEVICE_PUBLISH_HEADE_CARDSYSTEM_VERSION); //搜索结果 if (resultList2.size() > 0) { //QMessageBox::warning(this, "Export", QString(resultList.size())); for (int i = 0; i< wDevicePublishList->topLevelItemCount(); ++i) { QTreeWidgetItem* topItem = wDevicePublishList->topLevelItem(i); if (resultList2.contains(topItem)) wDevicePublishList->setRowHidden(i,wDevicePublishList->indexFromItem(topItem->parent()),false); //显示匹配的结果 else wDevicePublishList->setRowHidden(i,wDevicePublishList->indexFromItem(topItem->parent()),true); //隐藏不匹配的结果 } } else { QList resultList2 = wDevicePublishList->findItems(strtemp, Qt::MatchContains,ENUM_DEVICE_PUBLISH_HEADE_TAXIAPP_VERSION); //搜索结果 if (resultList2.size() > 0) { //QMessageBox::warning(this, "Export", QString(resultList.size())); for (int i = 0; i< wDevicePublishList->topLevelItemCount(); ++i) { QTreeWidgetItem* topItem = wDevicePublishList->topLevelItem(i); if (resultList2.contains(topItem)) wDevicePublishList->setRowHidden(i,wDevicePublishList->indexFromItem(topItem->parent()),false); //显示匹配的结果 else wDevicePublishList->setRowHidden(i,wDevicePublishList->indexFromItem(topItem->parent()),true); //隐藏不匹配的结果 } } else { QList resultList2 = wDevicePublishList->findItems(strtemp, Qt::MatchContains,ENUM_DEVICE_PUBLISH_HEADE_DISPLAYER_VERSION); //搜索结果 if (resultList2.size() > 0) { //QMessageBox::warning(this, "Export", QString(resultList.size())); for (int i = 0; i< wDevicePublishList->topLevelItemCount(); ++i) { QTreeWidgetItem* topItem = wDevicePublishList->topLevelItem(i); if (resultList2.contains(topItem)) wDevicePublishList->setRowHidden(i,wDevicePublishList->indexFromItem(topItem->parent()),false); //显示匹配的结果 else wDevicePublishList->setRowHidden(i,wDevicePublishList->indexFromItem(topItem->parent()),true); //隐藏不匹配的结果 } } else { QList resultList2 = wDevicePublishList->findItems(strtemp, Qt::MatchContains,ENUM_DEVICE_PUBLISH_HEADE_STARTER_VERSION); //搜索结果 if (resultList2.size() > 0) { //QMessageBox::warning(this, "Export", QString(resultList.size())); for (int i = 0; i< wDevicePublishList->topLevelItemCount(); ++i) { QTreeWidgetItem* topItem = wDevicePublishList->topLevelItem(i); if (resultList2.contains(topItem)) wDevicePublishList->setRowHidden(i,wDevicePublishList->indexFromItem(topItem->parent()),false); //显示匹配的结果 else wDevicePublishList->setRowHidden(i,wDevicePublishList->indexFromItem(topItem->parent()),true); //隐藏不匹配的结果 } } else { QList resultList2 = wDevicePublishList->findItems(strtemp, Qt::MatchContains,ENUM_DEVICE_PUBLISH_HEADE_CONNECTION_VERSION); //搜索结果 if (resultList2.size() > 0) { //QMessageBox::warning(this, "Export", QString(resultList.size())); for (int i = 0; i< wDevicePublishList->topLevelItemCount(); ++i) { QTreeWidgetItem* topItem = wDevicePublishList->topLevelItem(i); if (resultList2.contains(topItem)) wDevicePublishList->setRowHidden(i,wDevicePublishList->indexFromItem(topItem->parent()),false); //显示匹配的结果 else wDevicePublishList->setRowHidden(i,wDevicePublishList->indexFromItem(topItem->parent()),true); //隐藏不匹配的结果 } } else { QList resultList2 = wDevicePublishList->findItems(strtemp, Qt::MatchContains,ENUM_DEVICE_PUBLISH_HEADE_UPDATE_VERSION); //搜索结果 if (resultList2.size() > 0) { //QMessageBox::warning(this, "Export", QString(resultList.size())); for (int i = 0; i< wDevicePublishList->topLevelItemCount(); ++i) { QTreeWidgetItem* topItem = wDevicePublishList->topLevelItem(i); if (resultList2.contains(topItem)) wDevicePublishList->setRowHidden(i,wDevicePublishList->indexFromItem(topItem->parent()),false); //显示匹配的结果 else wDevicePublishList->setRowHidden(i,wDevicePublishList->indexFromItem(topItem->parent()),true); //隐藏不匹配的结果 } } else { QList resultList2 = wDevicePublishList->findItems(strtemp, Qt::MatchContains,ENUM_DEVICE_PUBLISH_HEADE_FPAG_VERSION); //搜索结果 if (resultList2.size() > 0) { //QMessageBox::warning(this, "Export", QString(resultList.size())); for (int i = 0; i< wDevicePublishList->topLevelItemCount(); ++i) { QTreeWidgetItem* topItem = wDevicePublishList->topLevelItem(i); if (resultList2.contains(topItem)) wDevicePublishList->setRowHidden(i,wDevicePublishList->indexFromItem(topItem->parent()),false); //显示匹配的结果 else wDevicePublishList->setRowHidden(i,wDevicePublishList->indexFromItem(topItem->parent()),true); //隐藏不匹配的结果 } } else { QList resultList2 = wDevicePublishList->findItems(strtemp, Qt::MatchContains,ENUM_DEVICE_PUBLISH_HEADE_REMARKS); //搜索结果 if (resultList2.size() > 0) { //QMessageBox::warning(this, "Export", QString(resultList.size())); for (int i = 0; i< wDevicePublishList->topLevelItemCount(); ++i) { QTreeWidgetItem* topItem = wDevicePublishList->topLevelItem(i); if (resultList2.contains(topItem)) wDevicePublishList->setRowHidden(i,wDevicePublishList->indexFromItem(topItem->parent()),false); //显示匹配的结果 else wDevicePublishList->setRowHidden(i,wDevicePublishList->indexFromItem(topItem->parent()),true); //隐藏不匹配的结果 } } else { for (int i = 0; i< wDevicePublishList->topLevelItemCount(); ++i) { QTreeWidgetItem* topItem = wDevicePublishList->topLevelItem(i); wDevicePublishList->setRowHidden(i,wDevicePublishList->indexFromItem(topItem->parent()),true); //隐藏不匹配的结果 } } } } } } } } } } } } } } } }