添加数据库名称配置

This commit is contained in:
duanshengchao 2025-04-02 18:09:48 +08:00
parent 8455d6522c
commit bba170ba95
2 changed files with 213 additions and 165 deletions

View File

@ -149,6 +149,7 @@ void ConnectionDialog::removeConnListItem(int row)
ui->lineEdit_port->setText("5432");
ui->lineEdit_userName->setText("");
ui->lineEdit_password->setText("");
ui->lineEdit_dbName->setText("");
ui->comboBox_dbType->setCurrentText("PostgreSQL");
ui->plainTextEdit->setPlainText("");
}
@ -178,6 +179,7 @@ void ConnectionDialog::loadConnInfo(const QString& connID)
ui->lineEdit_port->setText(QString::number(config.nPort));
ui->lineEdit_userName->setText(config.strUserName);
ui->lineEdit_password->setText(config.strPassword);
ui->lineEdit_dbName->setText(config.strDBName);
if(config.strDBType == "QPSQL")
ui->comboBox_dbType->setCurrentText("PostgreSQL");
else if(config.strDBType == "QMYSQL")
@ -253,6 +255,7 @@ void ConnectionDialog::onBtnClicked_open()
config.nPort = ui->lineEdit_port->text().toInt();
config.strUserName = ui->lineEdit_userName->text();
config.strPassword = ui->lineEdit_password->text();
config.strDBName = ui->lineEdit_dbName->text();
if(ui->comboBox_dbType->currentText() == "PostgreSQL")
config.strDBType = "QPSQL";
else if(ui->comboBox_dbType->currentText() == "MySQL")
@ -294,6 +297,7 @@ void ConnectionDialog::onBtnClicked_save()
config.nPort = ui->lineEdit_port->text().toInt();
config.strUserName = ui->lineEdit_userName->text();
config.strPassword = ui->lineEdit_password->text();
config.strDBName = ui->lineEdit_dbName->text();
if(ui->comboBox_dbType->currentText() == "PostgreSQL")
config.strDBType = "QPSQL";
else if(ui->comboBox_dbType->currentText() == "MySQL")

View File

@ -51,6 +51,12 @@
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarPolicy::ScrollBarAsNeeded</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarPolicy::ScrollBarAlwaysOff</enum>
</property>
<property name="showGrid">
<bool>false</bool>
</property>
@ -183,42 +189,8 @@
<property name="verticalSpacing">
<number>10</number>
</property>
<item row="8" column="1">
<widget class="QComboBox" name="comboBox_dbType">
<property name="minimumSize">
<size>
<width>0</width>
<height>26</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>26</height>
</size>
</property>
<item>
<property name="text">
<string>PostgreSQL</string>
</property>
<property name="icon">
<iconset resource="../resource/PowerModeler.qrc">
<normaloff>:/img/images/icon_postgresql.png</normaloff>:/img/images/icon_postgresql.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>MySQL</string>
</property>
<property name="icon">
<iconset resource="../resource/PowerModeler.qrc">
<normaloff>:/img/images/icon_mysql.png</normaloff>:/img/images/icon_mysql.png</iconset>
</property>
</item>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="lineEdit_hostName">
<item row="1" column="1">
<widget class="QLineEdit" name="lineEdit_connection">
<property name="minimumSize">
<size>
<width>0</width>
@ -236,8 +208,8 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_hostName">
<item row="6" column="0">
<widget class="QLabel" name="label_userName">
<property name="minimumSize">
<size>
<width>91</width>
@ -251,11 +223,11 @@
</size>
</property>
<property name="text">
<string>主机名/IP地址</string>
<string>用户名</string>
</property>
</widget>
</item>
<item row="4" column="0">
<item row="5" column="0">
<widget class="QLabel" name="label_port">
<property name="minimumSize">
<size>
@ -274,8 +246,8 @@
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="lineEdit_userName">
<item row="3" column="1">
<widget class="QLineEdit" name="lineEdit_hostName">
<property name="minimumSize">
<size>
<width>0</width>
@ -293,7 +265,7 @@
</property>
</widget>
</item>
<item row="6" column="1">
<item row="7" column="1">
<widget class="QLineEdit" name="lineEdit_password">
<property name="minimumSize">
<size>
@ -315,128 +287,7 @@
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_userName">
<property name="minimumSize">
<size>
<width>91</width>
<height>21</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>91</width>
<height>21</height>
</size>
</property>
<property name="text">
<string>用户名:</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="label_dbType">
<property name="minimumSize">
<size>
<width>91</width>
<height>21</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>91</width>
<height>21</height>
</size>
</property>
<property name="text">
<string>数据库类型:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="lineEdit_connection">
<property name="minimumSize">
<size>
<width>0</width>
<height>21</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>21</height>
</size>
</property>
<property name="maxLength">
<number>30</number>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_connection">
<property name="minimumSize">
<size>
<width>91</width>
<height>21</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>91</width>
<height>21</height>
</size>
</property>
<property name="text">
<string>链接名称:</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_password">
<property name="minimumSize">
<size>
<width>91</width>
<height>21</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>91</width>
<height>21</height>
</size>
</property>
<property name="text">
<string>密码:</string>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QLabel" name="label_dbComment">
<property name="minimumSize">
<size>
<width>91</width>
<height>21</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>91</width>
<height>21</height>
</size>
</property>
<property name="text">
<string>备注:</string>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="QPlainTextEdit" name="plainTextEdit">
<property name="styleSheet">
<string notr="true"/>
</property>
</widget>
</item>
<item row="4" column="1">
<item row="5" column="1">
<widget class="QWidget" name="widget" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="leftMargin">
@ -486,6 +337,199 @@
</layout>
</widget>
</item>
<item row="10" column="0">
<widget class="QLabel" name="label_dbComment">
<property name="minimumSize">
<size>
<width>91</width>
<height>21</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>91</width>
<height>21</height>
</size>
</property>
<property name="text">
<string>备注:</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_hostName">
<property name="minimumSize">
<size>
<width>91</width>
<height>21</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>91</width>
<height>21</height>
</size>
</property>
<property name="text">
<string>主机名/IP地址</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_connection">
<property name="minimumSize">
<size>
<width>91</width>
<height>21</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>91</width>
<height>21</height>
</size>
</property>
<property name="text">
<string>链接名称:</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_password">
<property name="minimumSize">
<size>
<width>91</width>
<height>21</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>91</width>
<height>21</height>
</size>
</property>
<property name="text">
<string>密码:</string>
</property>
</widget>
</item>
<item row="10" column="1">
<widget class="QPlainTextEdit" name="plainTextEdit">
<property name="styleSheet">
<string notr="true"/>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QLineEdit" name="lineEdit_userName">
<property name="minimumSize">
<size>
<width>0</width>
<height>21</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>21</height>
</size>
</property>
<property name="maxLength">
<number>30</number>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_dbType">
<property name="minimumSize">
<size>
<width>91</width>
<height>21</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>91</width>
<height>21</height>
</size>
</property>
<property name="text">
<string>数据库类型:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboBox_dbType">
<property name="minimumSize">
<size>
<width>0</width>
<height>26</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>26</height>
</size>
</property>
<item>
<property name="text">
<string>PostgreSQL</string>
</property>
<property name="icon">
<iconset resource="../resource/PowerModeler.qrc">
<normaloff>:/img/images/icon_postgresql.png</normaloff>:/img/images/icon_postgresql.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>MySQL</string>
</property>
<property name="icon">
<iconset resource="../resource/PowerModeler.qrc">
<normaloff>:/img/images/icon_mysql.png</normaloff>:/img/images/icon_mysql.png</iconset>
</property>
</item>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="label_dbName">
<property name="minimumSize">
<size>
<width>91</width>
<height>21</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>91</width>
<height>21</height>
</size>
</property>
<property name="text">
<string>数据库名称:</string>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QLineEdit" name="lineEdit_dbName">
<property name="minimumSize">
<size>
<width>0</width>
<height>21</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>21</height>
</size>
</property>
<property name="maxLength">
<number>30</number>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">