feat:增加基模类别命名时首字母不能数字的限制
This commit is contained in:
parent
a06fe0f5a1
commit
7d9fa0c20b
|
|
@ -176,13 +176,16 @@ int AttributeTableModel::rowCount(const QModelIndex& parent) const
|
||||||
return m_currentPageData.count();
|
return m_currentPageData.count();
|
||||||
}
|
}
|
||||||
|
|
||||||
int AttributeTableModel::columnCount(const QModelIndex &) const
|
int AttributeTableModel::columnCount(const QModelIndex& parent) const
|
||||||
{
|
{
|
||||||
return m_displayField.isEmpty() ? 0 : m_displayField.count() + 1;
|
return m_displayField.isEmpty() ? 0 : m_displayField.count() + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Qt::ItemFlags AttributeTableModel::flags(const QModelIndex &index) const
|
Qt::ItemFlags AttributeTableModel::flags(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
|
if(!index.isValid())
|
||||||
|
return Qt::NoItemFlags;
|
||||||
|
|
||||||
Qt::ItemFlags flags = QAbstractTableModel::flags(index);
|
Qt::ItemFlags flags = QAbstractTableModel::flags(index);
|
||||||
QModelIndex numberIndex = createIndex(index.row(), 0);
|
QModelIndex numberIndex = createIndex(index.row(), 0);
|
||||||
QString text = numberIndex.data(Qt::DisplayRole).toString();
|
QString text = numberIndex.data(Qt::DisplayRole).toString();
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ bool DatabaseManager::connect(const QString& strConnectionName)
|
||||||
QString::fromWCharArray(L"没有找到该链接的配置信息"),
|
QString::fromWCharArray(L"没有找到该链接的配置信息"),
|
||||||
QSqlError::ConnectionError);
|
QSqlError::ConnectionError);
|
||||||
emit errorOccurred(strConnectionName, error.databaseText());
|
emit errorOccurred(strConnectionName, error.databaseText());
|
||||||
LOG_ERROR("DB", QString("Connection failed: %1 due 2%").arg(strConnectionName).arg("no configuration information"));
|
LOG_ERROR("DB", QString("Connection failed: %1 due to 2%").arg(strConnectionName, "no configuration information"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -113,10 +113,10 @@ bool DatabaseManager::connect(const QString& strConnectionName)
|
||||||
if(!db.open())
|
if(!db.open())
|
||||||
{
|
{
|
||||||
QString errorText = db.lastError().databaseText();
|
QString errorText = db.lastError().databaseText();
|
||||||
|
// QString transText = QString::fromUtf8(errorText.toLocal8Bit().constData());
|
||||||
|
// qDebug() << transText;
|
||||||
LOG_ERROR("DB", QString("DB: %1 open failed. connectionName: %2. error: %3")
|
LOG_ERROR("DB", QString("DB: %1 open failed. connectionName: %2. error: %3")
|
||||||
.arg(config.strDBName)
|
.arg(config.strDBName, strConnectionName, errorText));
|
||||||
.arg(strConnectionName)
|
|
||||||
.arg(errorText/*QString::fromUtf8(errorText.toUtf8())*/));
|
|
||||||
emit errorOccurred(strConnectionName, QString::fromWCharArray(L"数据库打开失败,详情可见日志文件"));
|
emit errorOccurred(strConnectionName, QString::fromWCharArray(L"数据库打开失败,详情可见日志文件"));
|
||||||
db.close();
|
db.close();
|
||||||
db = QSqlDatabase();//重置为无效数据库对象,在下面remove的时候就不会出现"connection '***' is still in use, all queries will cease to work"的警告
|
db = QSqlDatabase();//重置为无效数据库对象,在下面remove的时候就不会出现"connection '***' is still in use, all queries will cease to work"的警告
|
||||||
|
|
|
||||||
|
|
@ -113,8 +113,9 @@ void ModelInfoEditDialog::initialize()
|
||||||
m_curModelID = -1;
|
m_curModelID = -1;
|
||||||
ui->btnAddGroup->setVisible(false);
|
ui->btnAddGroup->setVisible(false);
|
||||||
m_pMaskLayer = new MaskLayer(this);
|
m_pMaskLayer = new MaskLayer(this);
|
||||||
//正则表达式,只能输入字母
|
//正则表达式,只能输入字母,且第一个字符不能是数字
|
||||||
QRegularExpression regExp("[A-Za-z0-9_]+");
|
//QRegularExpression regExp("[A-Za-z0-9_]+");
|
||||||
|
QRegularExpression regExp("^[A-Za-z_][A-Za-z0-9_]*$");
|
||||||
QRegularExpressionValidator* validator = new QRegularExpressionValidator(regExp, this);
|
QRegularExpressionValidator* validator = new QRegularExpressionValidator(regExp, this);
|
||||||
ui->lineEdit_modelType->setValidator(validator);
|
ui->lineEdit_modelType->setValidator(validator);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -311,11 +311,14 @@ QPushButton:pressed
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>*类别必须为英文,且首字符不能为数字</string>
|
||||||
|
</property>
|
||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
<string notr="true">color: rgb(255, 0, 0);</string>
|
<string notr="true">color: rgb(255, 0, 0);</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>*类别必须为英文</string>
|
<string>*类别必须为英文...</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignmentFlag::AlignCenter</set>
|
<set>Qt::AlignmentFlag::AlignCenter</set>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue