代码拉取完成,页面将自动刷新
同步操作将从 惊险一血/AutoVehTypeMon 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#include "dealexcelfile.h"
#include <QSqlError>
#include <QFileInfo>
#include <QMessageBox>
DealExcelFile::DealExcelFile(QObject *parent) :
QObject(parent)
{
xlsOpenFlag = false;
dbOpenFlag = false;
hasExistFile = false;
IsXlsFile = false;
IsDbFile = false;
m_bOpenSuccess = false;
sqlite = new multideal();//一个数据库操作接口
excelFile = new ExcelEngine;
//model = new QSqlTableModel(this);不能放在这里 否则TableView为空
//tableview = new QTableView(this);
//tableview->hide();
}
DealExcelFile::~DealExcelFile()
{
excelFile->Close();
}
DealExcelFile* getDealExecl()
{
static DealExcelFile execl;
return &execl;
}
bool DealExcelFile::OpenExcelFile()
{
if(!m_bOpenSuccess)
{
return false;
}
if(!excelFile->Open())
{
return false;
}
return true;
}
void DealExcelFile::Close()
{
excelFile->Close();
}
void DealExcelFile::Init()
{
QFile file("./RoadInfo.xls");
if(!file.exists())
{
m_bOpenSuccess = false;
QMessageBox::warning(0,"提示",tr("<font size='2' face='宋体'>路段表不存在</font>"),"确定");
return;
}
if(!file.open(QIODevice::ReadOnly))
{
m_bOpenSuccess = false;
return;
}
QFileInfo tmp(file);
excelFile->SetExcelFile(tmp.absoluteFilePath());
m_bOpenSuccess = true;
//excelFile->Init();
}
void DealExcelFile::createTable(int row, int col)
{
//excelTable = new QTableWidget(row,col,this);
excelTable = new QTableWidget(row,col);
excelTable->setGeometry(0,20,400,280);
excelFile->ReadDataToTable(excelTable);
excelTable->show();
xlsOpenFlag = true;
}
bool DealExcelFile::createTree(int row, int col,QTreeWidget* tree)
{
if(!OpenExcelFile())
{
return false;
}
excelTree = tree;
excelTree->setHeaderLabel("路段信息");
excelFile->ReadDataToTree(excelTree);
excelTree->show();
//excelTree->expandAll();
excelTree->collapseAll();
return true;
}
void DealExcelFile::SetPointStatue(const QString ip, const int statue)
{
QMutexLocker lock(&m_mutex);
//将设备状态存在map中,用于树初始化时设置树状态
excelFile->SetIPAndStatue(ip,statue);
excelFile->SetPointStatue(ip,statue);
}
//void DealExcelFile::SetIPAndStatue(const QString ip, const int statue)
//{
// QMutexLocker lock(&m_mutex);
// excelFile->SetIPAndStatue(ip,statue);
//}
bool DealExcelFile::GetIPByItem(QTreeWidgetItem *item, QString &ip)
{
QMutexLocker lock(&m_mutex);
return excelFile->GetItemLaneIP(item,ip);
}
bool DealExcelFile::GetNameByIP(const QString ip, QString &name,QString &firstName)
{
QMutexLocker lock(&m_mutex);
return excelFile->GetItemLaneName(ip,name,firstName);
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。