|
@@ -19,7 +19,6 @@
|
|
#include <QStandardItemModel>
|
|
#include <QStandardItemModel>
|
|
#include <QStandardItem>
|
|
#include <QStandardItem>
|
|
#include <QHeaderView>
|
|
#include <QHeaderView>
|
|
-
|
|
|
|
#include <QDebug>
|
|
#include <QDebug>
|
|
|
|
|
|
static const char *kDataTabName = "tabName";
|
|
static const char *kDataTabName = "tabName";
|
|
@@ -143,11 +142,12 @@ void DataTableWidget::setupModels()
|
|
SchemeInfoService().QuerySchemeInfoByEngineerId(&m_schemeList, m_process.projectId, 0);
|
|
SchemeInfoService().QuerySchemeInfoByEngineerId(&m_schemeList, m_process.projectId, 0);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ m_schemeStartIndex = hIndex + 1;
|
|
|
|
+
|
|
if (m_schemeList.count() > 0) {
|
|
if (m_schemeList.count() > 0) {
|
|
for (SchemaEval *scheme : m_schemeList) {
|
|
for (SchemaEval *scheme : m_schemeList) {
|
|
QStandardItem *item = new QStandardItem(scheme->name);
|
|
QStandardItem *item = new QStandardItem(scheme->name);
|
|
model->setHorizontalHeaderItem(++hIndex, item);
|
|
model->setHorizontalHeaderItem(++hIndex, item);
|
|
- m_schemeStartIndex = hIndex;
|
|
|
|
for (QString indexValue : scheme->valueStr.split(";")) {
|
|
for (QString indexValue : scheme->valueStr.split(";")) {
|
|
QStringList indexAndValue = indexValue.split(":");
|
|
QStringList indexAndValue = indexValue.split(":");
|
|
if (indexAndValue.size() < 2) {
|
|
if (indexAndValue.size() < 2) {
|
|
@@ -607,12 +607,13 @@ void DataTableWidget::itemChanged(QStandardItem *item)
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // 校验输入字符的合法性, 只允许输入非负数
|
|
|
|
+ // 遇到非法字符时, 恢复原值
|
|
static bool useOldData = false;
|
|
static bool useOldData = false;
|
|
if (useOldData) {
|
|
if (useOldData) {
|
|
useOldData = false;
|
|
useOldData = false;
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
-
|
|
|
|
// ([0-9]\\d*\\.?\\d*)|(0\\.\\d*[1-9])
|
|
// ([0-9]\\d*\\.?\\d*)|(0\\.\\d*[1-9])
|
|
// (-?[1-9][0-9]+)|(-?[0-9])|(-?[1-9]\\d+\\.\\d+)|(-?[0-9]\\.\\d+)
|
|
// (-?[1-9][0-9]+)|(-?[0-9])|(-?[1-9]\\d+\\.\\d+)|(-?[0-9]\\.\\d+)
|
|
QString Pattern("(\\d*\\.?\\d*)"); // 匹配非负数
|
|
QString Pattern("(\\d*\\.?\\d*)"); // 匹配非负数
|
|
@@ -662,5 +663,23 @@ void DataTableWidget::itemChanged(QStandardItem *item)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- if (schemeData) { }
|
|
|
|
|
|
+ if (schemeData) {
|
|
|
|
+ int index = item->column() - m_schemeStartIndex;
|
|
|
|
+ if (index < 0 || index >= m_schemeList.size()) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ SchemaEval *scheme = m_schemeList[index];
|
|
|
|
+
|
|
|
|
+ QStringList valueStr;
|
|
|
|
+ for (int i = 0; i < item->model()->rowCount(); i++) {
|
|
|
|
+ QStandardItem *vHeader = item->model()->verticalHeaderItem(i);
|
|
|
|
+ QStandardItem *t = item->model()->item(i, item->column());
|
|
|
|
+ if (t != nullptr && t->text().trimmed().length() > 0) {
|
|
|
|
+ QString value = QString("%1:%2").arg(vHeader->text()).arg(t->text());
|
|
|
|
+ valueStr.append(value);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ scheme->valueStr = valueStr.join(";");
|
|
|
|
+ SchemeInfoService().UpdateValueStrById(scheme->id, scheme->valueStr);
|
|
|
|
+ }
|
|
}
|
|
}
|