GreyClusteringConfigWidget.cpp 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530
  1. #include "GreyClusteringConfigWidget.h"
  2. #include "GreyClusteringItemDelegate.h"
  3. #include "MultiLevelHeaderView.h"
  4. #include "ui_GreyClusteringConfigWidget.h"
  5. #include "dbService/GradeInfoService.h"
  6. #include "dbService/EffectIndexInfoService.h"
  7. #include "CMind.h"
  8. #include <QLineEdit>
  9. #include <QDebug>
  10. #include <QMessageBox>
  11. GreyClusteringConfigWidget::GreyClusteringConfigWidget(CMind *mind, int grayNumber, QWidget *parent)
  12. : QWidget(parent), ui(new Ui::GreyClusteringConfigWidget), m_mind(mind), m_grayNumber(grayNumber)
  13. {
  14. ui->setupUi(this);
  15. ui->grayConfigTableView->setAlternatingRowColors(false);
  16. ui->grayConfigTableView->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
  17. ui->grayConfigTableView->horizontalHeader()->setStyleSheet(
  18. "QHeaderView::section{background:rgb(244,244,244);color: black;}");
  19. ui->grayConfigTableView->verticalHeader()->setStyleSheet(
  20. "QHeaderView::section{background:rgb(244,244,244);color: black;}");
  21. ui->grayConfigTableView->verticalHeader()->setDefaultAlignment(Qt::AlignCenter);
  22. ui->grayConfigTableView->setSelectionMode(QAbstractItemView::SingleSelection);
  23. // ui->grayConfigTableView->verticalHeader()->setDefaultSectionSize(20);
  24. ui->grayConfigTableView->horizontalHeader()->hide();
  25. m_model = new QStandardItemModel();
  26. ui->grayConfigTableView->setModel(m_model);
  27. ui->stackedWidget->setCurrentIndex(0);
  28. ui->grayNumber->setText(QString::number(grayNumber));
  29. initFormLayout();
  30. initClusteringItems();
  31. refreshTableView();
  32. resize(1200, 800);
  33. // ui->grayConfigTableView->setEditTriggers(QAbstractItemView::CurrentChanged); //单击触发
  34. }
  35. GreyClusteringConfigWidget::~GreyClusteringConfigWidget()
  36. {
  37. delete ui;
  38. }
  39. void GreyClusteringConfigWidget::initFormLayout()
  40. {
  41. QList<GradeInfo *> gradeInfoList;
  42. QMap<QString, QString> grayLevelMaps;
  43. int projectId = m_mind->root().projectId;
  44. if (!GradeInfoService().QueryGradeByProjectIdAndType(&gradeInfoList, projectId, 1)) {
  45. QMessageBox::warning(this, "警告", "数据库访问失败");
  46. } else {
  47. if (gradeInfoList.size() == 0) {
  48. for (int lvl = 0; lvl < m_grayNumber; ++lvl) {
  49. grayLevelMaps.insert(QString("级别 %1:").arg(lvl + 1), QString("E%1").arg(lvl + 1));
  50. GradeInfo ginfo;
  51. ginfo.projectId = projectId;
  52. ginfo.gradeName = QString("级别 %1").arg(lvl + 1);
  53. ginfo.gradeValue = QString("灰类%1级").arg(lvl + 1);
  54. ginfo.type = 1;
  55. if (!GradeInfoService().AddGradeInfo(ginfo)) {
  56. QMessageBox::warning(this, "警告", "数据库访问失败");
  57. }
  58. }
  59. } else {
  60. for (const auto &gi : gradeInfoList) {
  61. grayLevelMaps.insert(gi->gradeName, gi->gradeValue);
  62. if (grayLevelMaps.size() >= m_grayNumber) {
  63. break;
  64. }
  65. }
  66. // 缺少再补
  67. for (int lvl = grayLevelMaps.size(); lvl < m_grayNumber; ++lvl) {
  68. grayLevelMaps.insert(QString("级别 %1:").arg(lvl + 1), QString("E%1").arg(lvl + 1));
  69. GradeInfo ginfo;
  70. ginfo.projectId = projectId;
  71. ginfo.gradeName = QString("级别 %1").arg(lvl + 1);
  72. ginfo.gradeValue = QString("灰类%1级").arg(lvl + 1);
  73. ginfo.type = 1;
  74. if (!GradeInfoService().AddGradeInfo(ginfo)) {
  75. QMessageBox::warning(this, "警告", "数据库访问失败");
  76. }
  77. }
  78. m_grayNames = grayLevelMaps.values();
  79. ui->stackedWidget->setCurrentIndex(1);
  80. }
  81. }
  82. qDeleteAll(gradeInfoList);
  83. QMapIterator<QString, QString> iter(grayLevelMaps);
  84. while (iter.hasNext()) {
  85. iter.next();
  86. auto le = new QLineEdit;
  87. le->setPlaceholderText("请输入类别");
  88. le->setText(iter.value());
  89. le->setMinimumHeight(28);
  90. le->setMinimumWidth(200);
  91. ui->grayFormLayout->addRow(iter.key() + ":", le);
  92. }
  93. // qDebug() << ui->grayFormLayout->rowCount();
  94. connect(ui->graySaveBtn, &QToolButton::clicked, this, &GreyClusteringConfigWidget::onConfirmClick);
  95. connect(ui->editGrayBtn, &QToolButton::clicked, [=]() { ui->stackedWidget->setCurrentIndex(0); });
  96. }
  97. void GreyClusteringConfigWidget::initClusteringItems()
  98. {
  99. // 脑图层级 < 2 时无效
  100. if (m_mind->levels() < 2) {
  101. return;
  102. }
  103. m_greyClusterings.clear();
  104. // 使用倒数第二层节点及其子节点
  105. int row = 0;
  106. for (CNodeData n : m_mind->nodesInLevel(m_mind->levels() - 1)) {
  107. GreyClusteringItem parentItem = { n.name, row, 0, 1, 1, nullptr };
  108. QList<CNodeData> subNodes = m_mind->subNodes(n);
  109. parentItem.colSpan = subNodes.size() == 0 ? 2 : 1; // 没有子节点,占两列,否则占一列
  110. parentItem.rowSpan = subNodes.size() == 0 ? 1 : subNodes.size(); // 没有子节点,占一行,否则占子节点数目行
  111. if (subNodes.size() == 0) { // 没有子节点,需要录入值
  112. GreyClusteringValue *sg = new GreyClusteringValue;
  113. sg->units = n.dimension;
  114. sg->weiget = 0;
  115. for (const auto &gname : m_grayNames) {
  116. sg->greyRanges << GreyRange { gname, true, 0, true, 0 };
  117. }
  118. sg->leftExtension = 0;
  119. sg->rightExtension = 0;
  120. sg->oldValue = 0;
  121. sg->newValue = 0;
  122. parentItem.value.reset(sg);
  123. }
  124. m_greyClusterings.append(parentItem);
  125. int subRow = row;
  126. // 子节点
  127. for (const CNodeData &sub : subNodes) {
  128. // 因为已有父节点,所以在第2列
  129. GreyClusteringItem childItem = { sub.name, subRow, 1, 1, 1, nullptr };
  130. GreyClusteringValue *sg = new GreyClusteringValue;
  131. sg->units = sub.dimension;
  132. sg->weiget = 0;
  133. for (const auto &gname : m_grayNames) {
  134. sg->greyRanges << GreyRange { gname, true, 0, true, 0 };
  135. }
  136. sg->leftExtension = 0;
  137. sg->rightExtension = 0;
  138. sg->oldValue = 0;
  139. sg->newValue = 0;
  140. childItem.value.reset(sg);
  141. m_greyClusterings.append(childItem);
  142. subRow++;
  143. }
  144. row += parentItem.rowSpan;
  145. }
  146. m_rowCount = row;
  147. // 数据库对比更新
  148. QList<EffectIndexInfo *> effectIndexInfoList;
  149. int projectid = m_mind->root().projectId;
  150. if (!EffectIndexInfoService().QueryEffectIndexInfoByProjectId(&effectIndexInfoList, projectid)) {
  151. QMessageBox::warning(this, "警告", "数据库访问失败");
  152. return;
  153. }
  154. if (effectIndexInfoList.size() == 0) {
  155. for (const auto &item : m_greyClusterings) {
  156. if (item.value.isNull()) {
  157. continue;
  158. }
  159. EffectIndexInfo effInfo;
  160. effInfo.projectId = projectid;
  161. effInfo.effectIndexName = item.indexName;
  162. QString effectIndexValue;
  163. for (const auto &range : item.value->greyRanges) {
  164. effectIndexValue += ",";
  165. effectIndexValue += range.leftClose ? "[" : "(";
  166. effectIndexValue += QString("%1:%2").arg(range.leftValue).arg(range.rightValue);
  167. effectIndexValue += range.rightClose ? "]" : ")";
  168. }
  169. effInfo.effectIndexValue = effectIndexValue.mid(1);
  170. effInfo.effectIndexUnit = item.value->units;
  171. effInfo.extendLeft = item.value->leftExtension;
  172. effInfo.extendRight = item.value->rightExtension;
  173. if (!EffectIndexInfoService().AddEffectIndexInfo(effInfo)) {
  174. QMessageBox::warning(this, "警告", "数据库访问失败");
  175. break;
  176. }
  177. }
  178. } else {
  179. for (auto &item : m_greyClusterings) {
  180. if (item.value.isNull()) {
  181. continue;
  182. }
  183. for (const auto &effInfo : effectIndexInfoList) {
  184. if (effInfo->effectIndexName == item.indexName) {
  185. if (effInfo->effectIndexUnit.length() > 0) {
  186. // item.value->units = effInfo->effectIndexUnit;
  187. }
  188. item.value->leftExtension = effInfo->extendLeft.toDouble();
  189. item.value->rightExtension = effInfo->extendRight.toDouble();
  190. //[0:0],[0:0],[0:0]
  191. QStringList valueList;
  192. if (effInfo->effectIndexValue.length() > 0) {
  193. valueList = effInfo->effectIndexValue.split(",");
  194. }
  195. int align = qMin(valueList.size(), item.value->greyRanges.size());
  196. for (int str = 0; str < align; str++) {
  197. //[0:0]
  198. QStringList lr = valueList.at(str).mid(1, valueList.at(str).size() - 2).split(":");
  199. if (valueList.at(str).left(1) == "[") {
  200. item.value->greyRanges[str].leftClose = true;
  201. } else {
  202. item.value->greyRanges[str].leftClose = false;
  203. }
  204. item.value->greyRanges[str].leftValue = lr.at(0).toDouble();
  205. item.value->greyRanges[str].rightValue = lr.at(1).toDouble();
  206. if (valueList.at(str).right(1) == "]") {
  207. item.value->greyRanges[str].rightClose = true;
  208. } else {
  209. item.value->greyRanges[str].rightClose = false;
  210. }
  211. }
  212. }
  213. }
  214. }
  215. }
  216. qDeleteAll(effectIndexInfoList);
  217. connect(ui->configSaveBtn, &QToolButton::clicked, this, &GreyClusteringConfigWidget::onConfigSaveBtnClick);
  218. }
  219. /**
  220. #if 0 // 竖直表头
  221. auto vHeader = new MultiLevelHeaderView(Qt::Vertical, 9, 3, t);
  222. vHeader->setColumnWidth(0, 40);
  223. vHeader->setColumnWidth(1, 40);
  224. vHeader->setColumnWidth(2, 80);
  225. vHeader->setCellSpan(0, 0, 9, 1);
  226. vHeader->setCellSpan(0, 1, 1, 2);
  227. vHeader->setCellSpan(1, 1, 3, 1);
  228. vHeader->setCellSpan(1, 2, 1, 1);
  229. vHeader->setCellSpan(2, 2, 1, 1);
  230. vHeader->setCellSpan(3, 2, 1, 1);
  231. vHeader->setCellSpan(4, 1, 1, 2);
  232. vHeader->setCellSpan(5, 1, 1, 2);
  233. vHeader->setCellSpan(6, 1, 1, 2);
  234. vHeader->setCellSpan(7, 1, 2, 1);
  235. vHeader->setCellSpan(7, 2, 1, 1);
  236. vHeader->setCellSpan(8, 2, 1, 1);
  237. vHeader->setCellText(0, 0, "火力");
  238. vHeader->setCellText(0, 1, "火炮口径");
  239. vHeader->setCellText(1, 1, "初速");
  240. vHeader->setCellText(1, 2, "穿甲弹");
  241. vHeader->setCellText(2, 2, "破甲弹");
  242. vHeader->setCellText(3, 2, "榴弹");
  243. vHeader->setCellText(4, 1, "首发命中率");
  244. vHeader->setCellText(5, 1, "直射距离");
  245. vHeader->setCellText(6, 1, "弹药基数");
  246. vHeader->setCellText(7, 1, "时间");
  247. vHeader->setCellText(7, 2, "静对静");
  248. vHeader->setCellText(8, 2, "静对动");
  249. t->setVerticalHeader(vHeader);
  250. #endif
  251. */
  252. struct IndexItem
  253. {
  254. QString name;
  255. int row;
  256. int col;
  257. int rowSpan;
  258. int colSpan;
  259. };
  260. void GreyClusteringConfigWidget::refreshTableView()
  261. {
  262. QTableView *t = ui->grayConfigTableView;
  263. m_model->clear();
  264. // 设置表头
  265. {
  266. auto hHeader = new MultiLevelHeaderView(Qt::Horizontal, 2, nodeDepth + 3 + m_grayNames.size(), t);
  267. hHeader->setSectionResizeMode(QHeaderView::Stretch);
  268. hHeader->setCellSpan(0, 0, 2, nodeDepth); // 指标占位
  269. for (int n = 0; n < 1 + m_grayNames.size(); ++n) { // 单位+灰度级占位
  270. hHeader->setCellSpan(0, nodeDepth + n, 2, 1);
  271. }
  272. hHeader->setCellSpan(0, nodeDepth + 1 + m_grayNames.size(), 1, 2); // 延拓值占位
  273. hHeader->setCellSpan(1, nodeDepth + 1 + m_grayNames.size(), 1, 1);
  274. hHeader->setCellSpan(1, nodeDepth + 1 + m_grayNames.size() + 1, 1, 1);
  275. // 一级
  276. hHeader->setCellText(0, 0, QString("指标"));
  277. hHeader->setCellText(0, nodeDepth, QString("单位"));
  278. for (int i = 0; i < m_grayNames.size(); ++i) {
  279. hHeader->setCellText(0, nodeDepth + 1 + i, m_grayNames.at(i));
  280. }
  281. hHeader->setCellText(0, nodeDepth + 1 + m_grayNames.size(), QString("延拓值"));
  282. // 二级
  283. hHeader->setCellText(1, nodeDepth + 1 + m_grayNames.size(), "左");
  284. hHeader->setCellText(1, nodeDepth + 2 + m_grayNames.size(), "右");
  285. t->setHorizontalHeader(hHeader);
  286. }
  287. m_model->setColumnCount(nodeDepth + 3 + m_grayNames.size());
  288. m_model->setRowCount(m_rowCount);
  289. // 其余的都可输入
  290. for (int r = 0; r < m_model->rowCount(); ++r) {
  291. for (int c = nodeDepth; c < m_model->columnCount(); ++c) {
  292. auto s = new QStandardItem();
  293. s->setTextAlignment(Qt::AlignCenter);
  294. m_model->setItem(r, c, s);
  295. }
  296. }
  297. for (auto &item : m_greyClusterings) {
  298. // 指标栏
  299. auto s = new QStandardItem(item.indexName);
  300. s->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
  301. s->setTextAlignment(Qt::AlignCenter);
  302. s->setToolTip(item.indexName);
  303. m_model->setItem(item.row, item.col, s);
  304. if (item.rowSpan > 1 || item.colSpan > 1) {
  305. t->setSpan(item.row, item.col, item.rowSpan, item.colSpan);
  306. }
  307. if (!item.value.isNull()) {
  308. m_model->item(item.row, nodeDepth)->setText(item.value->units); // 量纲
  309. m_model->item(item.row, nodeDepth)->setEditable(false);
  310. for (int r = 0; r < item.value->greyRanges.size(); r++) {
  311. m_model->item(item.row, nodeDepth + r + 1)
  312. ->setText(QString("%1%2, %3%4")
  313. .arg((item.value->greyRanges[r].leftClose ? "[" : "("))
  314. .arg(item.value->greyRanges[r].leftValue)
  315. .arg(item.value->greyRanges[r].rightValue)
  316. .arg((item.value->greyRanges[r].rightClose ? "]" : ")")));
  317. }
  318. if (m_model->columnCount() > nodeDepth + m_grayNumber + 2) {
  319. m_model->item(item.row, nodeDepth + m_grayNumber + 1)
  320. ->setText(QString::number(item.value->leftExtension));
  321. m_model->item(item.row, nodeDepth + m_grayNumber + 2)
  322. ->setText(QString::number(item.value->rightExtension));
  323. }
  324. }
  325. }
  326. for (int c = 0; c < m_grayNames.size(); ++c) {
  327. t->setItemDelegateForColumn(c + nodeDepth + 1, new GreyClusteringItemRangeDelegate(t));
  328. }
  329. for (int c = m_grayNames.size(); c < m_grayNames.size() + 2; ++c) {
  330. t->setItemDelegateForColumn(c + nodeDepth + 1, new GreyClusteringItemSpinDelegate(t));
  331. }
  332. }
  333. void GreyClusteringConfigWidget::onConfirmClick()
  334. {
  335. QStringList names;
  336. for (int i = 0; i < m_grayNumber; ++i) {
  337. QLayoutItem *item = ui->grayFormLayout->itemAt(i + 1, QFormLayout::FieldRole);
  338. QLineEdit *le = qobject_cast<QLineEdit *>(item->widget());
  339. if (le) {
  340. if (le->text().trimmed().isEmpty()) {
  341. QMessageBox::warning(this, tr("警告"), tr("级别%1不能为空!").arg(i + 1));
  342. return;
  343. }
  344. names << le->text().trimmed();
  345. }
  346. }
  347. if (names.toSet().size() != m_grayNumber) {
  348. QMessageBox::warning(this, tr("警告"), tr("类别名不能重复!"));
  349. return;
  350. }
  351. m_grayNames = names;
  352. // 更新数据库等级值
  353. QList<GradeInfo *> gradeInfoList;
  354. if (!GradeInfoService().QueryGradeByProjectIdAndType(&gradeInfoList, m_mind->root().projectId, 1)) {
  355. QMessageBox::warning(this, "警告", "数据库访问失败");
  356. return;
  357. }
  358. for (auto gi : gradeInfoList) {
  359. int num = gi->gradeName.mid(3, gi->gradeName.size() - 3).toInt();
  360. if (num < names.size() + 1) {
  361. if (gi->gradeValue != names.at(num - 1)) {
  362. gi->gradeValue = names.at(num - 1);
  363. if (!GradeInfoService().UpdateGradeInfo(*gi)) {
  364. QMessageBox::warning(this, "警告", "数据库访问失败");
  365. return;
  366. }
  367. }
  368. }
  369. }
  370. qDeleteAll(gradeInfoList);
  371. // 刷新表格
  372. refreshTableView();
  373. ui->stackedWidget->setCurrentIndex(1);
  374. }
  375. static bool isNeedUpdate(const EffectIndexInfo &effInfo, const GreyClusteringItem &item)
  376. {
  377. if (effInfo.effectIndexUnit != item.value->units) {
  378. return true;
  379. }
  380. QString effectIndexValue;
  381. for (const auto &range : item.value->greyRanges) {
  382. effectIndexValue += ",";
  383. effectIndexValue += range.leftClose ? "[" : "(";
  384. effectIndexValue += QString("%1:%2").arg(range.leftValue).arg(range.rightValue);
  385. effectIndexValue += range.rightClose ? "]" : ")";
  386. }
  387. if (effInfo.effectIndexValue != effectIndexValue.mid(1)) {
  388. return true;
  389. }
  390. if (effInfo.extendLeft.toDouble() != item.value->leftExtension) {
  391. return true;
  392. }
  393. if (effInfo.extendRight.toDouble() != item.value->rightExtension) {
  394. return true;
  395. }
  396. return false;
  397. }
  398. void GreyClusteringConfigWidget::onConfigSaveBtnClick()
  399. {
  400. for (auto &item : m_greyClusterings) {
  401. if (item.value.isNull()) {
  402. continue;
  403. }
  404. item.value->units = m_model->item(item.row, nodeDepth)->text(); // 指标
  405. for (int r = 0; r < item.value->greyRanges.size(); r++) {
  406. QString str = m_model->item(item.row, nodeDepth + r + 1)->text();
  407. item.value->greyRanges[r].leftClose = str[0] == "[";
  408. item.value->greyRanges[r].rightClose = str.right(1) == "]";
  409. QStringList list = str.mid(1, str.size() - 2).replace(" ", "").split(",");
  410. item.value->greyRanges[r].leftValue = list.at(0).toDouble();
  411. item.value->greyRanges[r].rightValue = list.at(1).toDouble();
  412. }
  413. item.value->leftExtension = m_model->item(item.row, nodeDepth + m_grayNumber + 1)->text().toDouble();
  414. item.value->rightExtension = m_model->item(item.row, nodeDepth + m_grayNumber + 2)->text().toDouble();
  415. }
  416. // 更新数据库
  417. QList<EffectIndexInfo *> effectIndexInfoList;
  418. int projectid = m_mind->root().projectId;
  419. if (!EffectIndexInfoService().QueryEffectIndexInfoByProjectId(&effectIndexInfoList, projectid)) {
  420. QMessageBox::warning(this, "警告", "数据库访问失败");
  421. return;
  422. }
  423. for (auto &item : m_greyClusterings) {
  424. if (item.value.isNull()) {
  425. continue;
  426. }
  427. bool found = false;
  428. for (auto &effInfo : effectIndexInfoList) {
  429. if (effInfo->effectIndexName == item.indexName) {
  430. found = true;
  431. if (isNeedUpdate(*effInfo, item)) {
  432. QString effectIndexValue;
  433. for (const auto &range : item.value->greyRanges) {
  434. effectIndexValue += ",";
  435. effectIndexValue += range.leftClose ? "[" : "(";
  436. effectIndexValue += QString("%1:%2").arg(range.leftValue).arg(range.rightValue);
  437. effectIndexValue += range.rightClose ? "]" : ")";
  438. }
  439. effInfo->effectIndexValue = effectIndexValue.mid(1);
  440. effInfo->effectIndexUnit = item.value->units;
  441. effInfo->extendLeft = QString::number(item.value->leftExtension);
  442. effInfo->extendRight = QString::number(item.value->rightExtension);
  443. if (!EffectIndexInfoService().UpdateEffectIndexInfo(*effInfo)) {
  444. QMessageBox::warning(this, "警告", "数据库访问失败");
  445. qDeleteAll(effectIndexInfoList);
  446. return;
  447. }
  448. }
  449. break;
  450. }
  451. }
  452. if (!found) { // 新增
  453. EffectIndexInfo effInfo;
  454. effInfo.projectId = projectid;
  455. effInfo.effectIndexName = item.indexName;
  456. QString effectIndexValue;
  457. for (const auto &range : item.value->greyRanges) {
  458. effectIndexValue += ",";
  459. effectIndexValue += range.leftClose ? "[" : "(";
  460. effectIndexValue += QString("%1:%2").arg(range.leftValue).arg(range.rightValue);
  461. effectIndexValue += range.rightClose ? "]" : ")";
  462. }
  463. effInfo.effectIndexValue = effectIndexValue.mid(1);
  464. effInfo.effectIndexUnit = item.value->units;
  465. effInfo.extendLeft = QString::number(item.value->leftExtension);
  466. effInfo.extendRight = QString::number(item.value->rightExtension);
  467. if (!EffectIndexInfoService().AddEffectIndexInfo(effInfo)) {
  468. QMessageBox::warning(this, "警告", "数据库访问失败");
  469. break;
  470. }
  471. }
  472. }
  473. qDeleteAll(effectIndexInfoList);
  474. }