增加继电器1,2

This commit is contained in:
zhangsheng 2024-11-19 11:29:38 +08:00
parent 8085a2875b
commit d76ec6e50b
3 changed files with 124 additions and 76 deletions

View File

@ -31,10 +31,14 @@ CConfiguration::CConfiguration(QWidget *parent) :
pHeader2->setSectionResizeMode(QHeaderView::ResizeToContents); pHeader2->setSectionResizeMode(QHeaderView::ResizeToContents);
pHeader2->setStretchLastSection(false); pHeader2->setStretchLastSection(false);
ui->treeView_Available->setEditTriggers(QAbstractItemView::NoEditTriggers); ui->treeView_Available->setEditTriggers(QAbstractItemView::NoEditTriggers);
ui->treeView_Relay->setEditTriggers(QAbstractItemView::NoEditTriggers); ui->treeView_Relay->setEditTriggers(QAbstractItemView::NoEditTriggers);
connect(ui->comboBox_WC,SIGNAL(currentTextChanged(const QString &)),this,SLOT(on_comboBox_WC_currentTextChanged2(const QString&))); connect(ui->comboBox_WC,SIGNAL(currentTextChanged(const QString &)),this,SLOT(on_comboBox_WC_currentTextChanged2(const QString&)));
ui->label_4->setVisible(0);
ui->lineEdit_2->setVisible(0);
ui->label_10->setVisible(0);
} }
CConfiguration::~CConfiguration() CConfiguration::~CConfiguration()
@ -665,6 +669,12 @@ void CConfiguration::on_pushButton_confirm_clicked()
}else if(ui->radioButton_10->isChecked()){ }else if(ui->radioButton_10->isChecked()){
flag = 1; flag = 1;
ConfiguraitonsObj = SelectChannel(12); ConfiguraitonsObj = SelectChannel(12);
}else if(ui->radioButton_11->isChecked()){
flag = 1;
ConfiguraitonsObj = SelectChannel(1);
}else if(ui->radioButton_12->isChecked()){
flag = 1;
ConfiguraitonsObj = SelectChannel(2);
} }
if(flag == -1){ if(flag == -1){
@ -705,7 +715,7 @@ void CConfiguration::on_pushButton_confirm_clicked()
ConfiguraitonsObj2 = ConfiguraitonsObj; ConfiguraitonsObj2 = ConfiguraitonsObj;
ConfiguraitonsObj["logicExpress"] = rootArray; ConfiguraitonsObj["logicExpress"] = rootArray;
ConfiguraitonsObj2["logicExpress"] = logicExpressArray2; ConfiguraitonsObj2["logicExpress"] = logicExpressArray2;
saveJsonToFile(ConfiguraitonsObj, "TreeViewToJSON.json"); //saveJsonToFile(ConfiguraitonsObj, "TreeViewToJSON.json");
QString strTableName = " t_UnitConfiguration "; QString strTableName = " t_UnitConfiguration ";
QVector<UnitConfiguration_t> vecUnitConfiguration = g_SqliteDB->GetUnitConfigurationInfo(strTableName); QVector<UnitConfiguration_t> vecUnitConfiguration = g_SqliteDB->GetUnitConfigurationInfo(strTableName);
for (int i = 0; i < vecUnitConfiguration.size(); i++) { for (int i = 0; i < vecUnitConfiguration.size(); i++) {
@ -1427,3 +1437,19 @@ void CConfiguration::on_treeView_Available_pressed(const QModelIndex &index)
} }
void CConfiguration::on_radioButton_11_clicked()
{
m_curentRLY = 1;
ui->label_3->setText(ui->radioButton_11->text()+"");
ViewRelay(1);
}
void CConfiguration::on_radioButton_12_clicked()
{
m_curentRLY = 2;
ui->label_3->setText(ui->radioButton_12->text()+"");
ViewRelay(2);
}

View File

@ -58,6 +58,10 @@ private slots:
void on_treeView_Available_pressed(const QModelIndex &index); void on_treeView_Available_pressed(const QModelIndex &index);
void on_radioButton_12_clicked();
void on_radioButton_11_clicked();
private: private:
Ui::CConfiguration *ui; Ui::CConfiguration *ui;

View File

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1052</width> <width>1052</width>
<height>640</height> <height>659</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -112,6 +112,9 @@ color: rgb(27, 30, 35);</string>
<property name="text"> <property name="text">
<string>选择继电器</string> <string>选择继电器</string>
</property> </property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -122,20 +125,33 @@ color: rgb(27, 30, 35);</string>
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_6"> <layout class="QVBoxLayout" name="verticalLayout_7">
<item> <item>
<widget class="Line" name="line"> <widget class="Line" name="line">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
</widget> </widget>
</item> </item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_6">
<property name="spacing">
<number>18</number>
</property>
<item>
<widget class="QRadioButton" name="radioButton_11">
<property name="text">
<string>继电器1</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButton_12">
<property name="text">
<string>继电器2</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QRadioButton" name="radioButton_1"> <widget class="QRadioButton" name="radioButton_1">
<property name="text"> <property name="text">
@ -207,6 +223,8 @@ color: rgb(27, 30, 35);</string>
</widget> </widget>
</item> </item>
</layout> </layout>
</item>
</layout>
</widget> </widget>
</item> </item>
</layout> </layout>