| | |
| | | ui->setupUi(this); |
| | | m_menu = nullptr; |
| | | //initUi(); |
| | | readInfo(); // 加载表格 |
| | | //readInfo(); // 加载表格 |
| | | addMenu(); // 增加菜单 |
| | | |
| | | // 自适应处理 |
| | |
| | | it4->setCheckState(0,Qt::Checked); |
| | | |
| | | // 复选框状态处理 |
| | | connect(ui->treeWidget,QOverload<QTreeWidgetItem*,int>::of(QTreeWidget::itemClicked),this,[=](QTreeWidgetItem* it,int index){ |
| | | connect(ui->treeWidget,QOverload<QTreeWidgetItem*,int>::of(&QTreeWidget::itemClicked),this,[=](QTreeWidgetItem* it,int index){ |
| | | qDebug()<<it<<index; |
| | | if(it == top1){ |
| | | qDebug()<<"点击了码蚁集团"; |
| | |
| | | { |
| | | if(m_curItem==nullptr)return; |
| | | qDebug()<<"添加公司信息,在节点:"<<m_curItem->text(0); |
| | | on_pushButton_laodFile_clicked(); |
| | | } |
| | | |
| | | void ConverInfo2::deleteInfo() |
| | | { |
| | | if(m_curItem==nullptr)return; |
| | | qDebug()<<"删除公司信息,节点:"<<m_curItem->text(0); |
| | | auto resList = m_curItem->takeChildren(); |
| | | |
| | | qDebug()<<"删除数量:"<<resList.size(); |
| | | } |
| | | |
| | | void ConverInfo2::on_treeWidget_doubleClicked(const QModelIndex &index) |
| | |
| | | it.next(); |
| | | list.append(it.fileInfo().absoluteFilePath()); |
| | | } |
| | | int allSize = list.size(); |
| | | float cntIdx=1.0; |
| | | foreach(QString str, list) |
| | | { |
| | | qDebug() << str; |
| | | int index = str.indexOf("内审统01表"); |
| | | qDebug()<<"index:"<<index; |
| | | |
| | | |
| | | if(index > 0){ |
| | | QAxObject excel("ket.Application"); |
| | | if(!excel.setControl("ket" |
| | |
| | | |
| | | qDebug()<<"单位信息数量:"<<m_nameAndComInfos.size(); |
| | | } |
| | | |
| | | // 控制显示进度相关 |
| | | emit loadProgress((cntIdx/allSize)*100); |
| | | cntIdx++; |
| | | } |
| | | |
| | | createTreeNode(); // 构建树形节点 |
| | | |
| | | // 发射 加载完成的信号 |
| | | emit loadFinished(); |
| | | |
| | | // QAxObject excel("./debug/Data/附件2_内审统01表_单位及内部审计机构基本情况表-1.301版(1).xls"); |
| | | // excel.setProperty("Visible",true); |
| | |
| | | for(int k=0;k<ui->treeWidget->topLevelItemCount();++k){ |
| | | QTreeWidgetItem *tmp = ui->treeWidget->topLevelItem(k); |
| | | qDebug()<<k<<tmp->text(0)<<upName.toString(); |
| | | if(upName.toString()+"(汇总)" == tmp->text(0)){ |
| | | int pos = tmp->text(0).indexOf(upName.toString()+"(汇总)"); |
| | | if(upName.toString()+"(汇总)" == tmp->text(0) || pos != -1){ |
| | | top = tmp; |
| | | break; |
| | | } |
| | |
| | | if(top){ // 存在,则添加到孩子列表中 |
| | | QTreeWidgetItem *top1 = new QTreeWidgetItem(top); |
| | | top1->setText(0,name.toString()); |
| | | top->setText(0,upName.toString()+"(汇总)下级数:"+QString::number(top->childCount()-1)); |
| | | }else{ // 不存在,则新建一个列表 |
| | | QTreeWidgetItem *top1 = new QTreeWidgetItem(ui->treeWidget); |
| | | top1->setText(0,name.toString()+"(汇总)"); |
| | | QTreeWidgetItem *top2 = new QTreeWidgetItem(top1); |
| | | top2->setText(0,name.toString()+"(本级)"); |
| | | top1->setText(0,name.toString()+"(汇总)下级数:"+QString::number(top1->childCount()-1)); |
| | | } |
| | | } |
| | | |
| | |
| | | top1->setText(0,name.toString()+"(汇总)"); |
| | | QTreeWidgetItem *top2 = new QTreeWidgetItem(top1); |
| | | top2->setText(0,name.toString()+"(本级)"); |
| | | top1->setText(0,name.toString()+"(汇总)下级数:"+QString::number(top1->childCount()-1)); |
| | | } |
| | | |
| | | } |
| | |
| | | readExcelFromPath(path); |
| | | } |
| | | } |
| | | |
| | | void ConverInfo2::showExcelSlot() |
| | | { |
| | | readInfo(); // 加载表格 |
| | | } |