英文输入限制加入‘_’的支持

This commit is contained in:
duanshengchao 2025-04-27 10:28:47 +08:00
parent 753a4a9e0c
commit bbae749216
12 changed files with 132 additions and 16 deletions

View File

@ -12,6 +12,9 @@ QT_END_NAMESPACE
class MainWindow;
class AttributeView;
class AttributeTableModel;
class AttributeTableDelegate;
class AttributeSelector : public QWidget
{
Q_OBJECT
@ -30,6 +33,8 @@ private:
Ui::AttributeSelector *ui;
MainWindow* m_pMainWindow;
AttributeView* m_attributeView;
AttributeTableModel* m_attributeTableModel;
AttributeTableDelegate* m_attributeTableDelegate;
QString m_connection;
};

View File

@ -1,5 +1,7 @@
<RCC>
<qresource prefix="img">
<file>images/icon_multiple-choice.png</file>
<file>images/icon_multiple-choice_disable.png</file>
<file>images/icon_hierarchy_unchecked.png</file>
<file>images/icon_hierarchy_disable.png</file>
<file>images/icon_search_white.png</file>

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 332 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 391 B

View File

@ -2,6 +2,8 @@
#include "ui_attributeSelector.h"
#include "mainwindow.h"
#include "attributeView.h"
#include "attributeTableModel.h"
#include "attributeTableDelegate.h"
AttributeSelector::AttributeSelector(const QString& connection, QWidget *parent)
: QWidget(parent)
@ -19,6 +21,12 @@ AttributeSelector::AttributeSelector(const QString& connection, QWidget *parent)
m_attributeView = new AttributeView(attributeGroup, ui->attributeViewContainer, connection);
ui->layoutTableView->addWidget(m_attributeView);
// m_attributeTableModel = new AttributeTableModel(attributeGroup, this, m_connection);
// m_tableView->setModel(m_attributeTableModel);
// m_attributeTableDelegate = new AttributeTableDelegate(m_tableView, m_connection, m_tableView);
// m_tableView->setItemDelegate(m_attributeTableDelegate);
connect(ui->btnRefresh, &QPushButton::clicked, this, &AttributeSelector::onBtnClicked_refreshData);
}

View File

@ -166,7 +166,7 @@ QWidget* AttributeTableDelegate::createEditor(QWidget *parent, const QStyleOptio
{
TextEditWidget* textEditor = new TextEditWidget(parent);
textEditor->setPrompt(QString::fromWCharArray(L"类型必须为英文"));
textEditor->setRegularExpression("[A-Za-z0-9]");
textEditor->setRegularExpression("[A-Za-z0-9_]");
connect(textEditor, &TextEditWidget::confirm, this, [=]{
/*QString strText = textEditor->editText();
int id = SqlQueryExecutor::instance().attributeTypeExistsInDB(m_connection, strText);

View File

@ -324,7 +324,7 @@ void DBStructureView::showContextMenu(const QPoint& pos)
removeNode(node);
})->setEnabled(!isPublic);
menu.addSeparator();
menu.addAction(QString::fromWCharArray(L"清空数据"), []{});
menu.addAction(QString::fromWCharArray(L"清空数据"), [this, node]{});
QPoint originPoint = this->mapToGlobal(QPoint(0,0));
menu.exec(originPoint + pos);
}

View File

@ -56,7 +56,7 @@ void ModelInfoEditDialog::initialize()
ui->btnAddGroup->setVisible(false);
m_pMaskLayer = new MaskLayer(this);
//正则表达式,只能输入字母
QRegularExpression regExp("[A-Za-z0-9]+");
QRegularExpression regExp("[A-Za-z0-9_]+");
QRegularExpressionValidator* validator = new QRegularExpressionValidator(regExp, this);
ui->lineEdit_modelType->setValidator(validator);

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>1111</width>
<height>481</height>
<width>1127</width>
<height>585</height>
</rect>
</property>
<property name="windowTitle">
@ -56,7 +56,7 @@ border-radius:3px;
}
</string>
</property>
<widget class="QLineEdit" name="lineEdit_name">
<widget class="QLineEdit" name="lineEdit_attributeType">
<property name="geometry">
<rect>
<x>80</x>
@ -66,7 +66,7 @@ border-radius:3px;
</rect>
</property>
</widget>
<widget class="QLabel" name="label_name">
<widget class="QLabel" name="label_atrributeType">
<property name="geometry">
<rect>
<x>20</x>
@ -76,13 +76,13 @@ border-radius:3px;
</rect>
</property>
<property name="text">
<string>属性名称</string>
<string>属性类别</string>
</property>
</widget>
<widget class="QPushButton" name="btnSearch">
<property name="geometry">
<rect>
<x>420</x>
<x>600</x>
<y>5</y>
<width>61</width>
<height>26</height>
@ -114,6 +114,62 @@ background-color:rgb(67,160,249);
<normaloff>:/img/images/icon_search_white.png</normaloff>:/img/images/icon_search_white.png</iconset>
</property>
</widget>
<widget class="QLabel" name="label_model">
<property name="geometry">
<rect>
<x>220</x>
<y>10</y>
<width>31</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>模型:</string>
</property>
</widget>
<widget class="QComboBox" name="comboBox_model">
<property name="geometry">
<rect>
<x>255</x>
<y>5</y>
<width>113</width>
<height>25</height>
</rect>
</property>
<item>
<property name="text">
<string>所有模型</string>
</property>
</item>
</widget>
<widget class="QComboBox" name="comboBox_group">
<property name="geometry">
<rect>
<x>450</x>
<y>5</y>
<width>113</width>
<height>25</height>
</rect>
</property>
<item>
<property name="text">
<string>所有属性组</string>
</property>
</item>
</widget>
<widget class="QLabel" name="label_group">
<property name="geometry">
<rect>
<x>400</x>
<y>10</y>
<width>41</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>属性组:</string>
</property>
</widget>
</widget>
</item>
<item>

View File

@ -116,13 +116,13 @@ QPushButton:pressed
<widget class="QWidget" name="recordControlPanel" native="true">
<property name="minimumSize">
<size>
<width>150</width>
<width>200</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>150</width>
<width>200</width>
<height>16777215</height>
</size>
</property>
@ -132,7 +132,7 @@ QPushButton:pressed
</property>
<property name="geometry">
<rect>
<x>10</x>
<x>36</x>
<y>5</y>
<width>21</width>
<height>21</height>
@ -177,7 +177,7 @@ QPushButton:pressed
</property>
<property name="geometry">
<rect>
<x>36</x>
<x>62</x>
<y>5</y>
<width>21</width>
<height>21</height>
@ -222,7 +222,7 @@ QPushButton:pressed
</property>
<property name="geometry">
<rect>
<x>62</x>
<x>88</x>
<y>5</y>
<width>21</width>
<height>21</height>
@ -264,7 +264,7 @@ QPushButton:pressed
</property>
<property name="geometry">
<rect>
<x>88</x>
<x>114</x>
<y>5</y>
<width>21</width>
<height>21</height>
@ -306,7 +306,7 @@ QPushButton:pressed
</property>
<property name="geometry">
<rect>
<x>114</x>
<x>140</x>
<y>5</y>
<width>21</width>
<height>21</height>
@ -345,6 +345,51 @@ QPushButton:pressed
</size>
</property>
</widget>
<widget class="QPushButton" name="btnSelect">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry">
<rect>
<x>10</x>
<y>5</y>
<width>21</width>
<height>21</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>21</width>
<height>21</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>21</width>
<height>21</height>
</size>
</property>
<property name="toolTip">
<string>添加</string>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../resource/PowerModeler.qrc">
<normaloff>:/img/images/icon_multiple-choice.png</normaloff>
<disabledoff>:/img/images/icon_multiple-choice_disable.png</disabledoff>:/img/images/icon_multiple-choice.png</iconset>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
</widget>
</widget>
</item>
<item>