📄 barform.ui.h
字号:
/****************************************************************************** ui.h extension file, included from the uic-generated form implementation.**** If you wish to add, delete or rename functions or slots use** Qt Designer which will update this file, preserving your code. Create an** init() function in place of a constructor, and a destroy() function in** place of a destructor.*****************************************************************************/int Lbar;QString Bar[16][3];void BarForm::init(){ int i, j; QString str, str1, str2; QDir::setCurrent("/root/FaultRecorder/"); QFile file( "bar_ratedvalue.DAT" ); file.open( IO_ReadOnly ); QTextStream stream( &file ); for ( i = 0; i < 16; i++ ){ for ( j = 0; j < 3; j++){ stream>>Bar[i][j]; if ( j==1 ){ str1 = ComboBox1->text( atoi(Bar[i][j-1]) ); str2 = ComboBox2->text( atoi(Bar[i][j]) ); Bar_Table->setText(i, 0, str1+" "+str2); //显示母线名称; } if ( j==2 ){ if (Bar[i][j] == "0"){ str = ""; }else if (Bar[i][j] == "1"){ str = CheckBox1->text(); } Bar_Table->setText(i, 1, str); //显示运行状态; } } str = ""; } Bar_Table->setColumnWidth(0,121); ComboBox1->setEnabled(FALSE); ComboBox2->setEnabled(FALSE); CheckBox1->setEnabled(FALSE); savePushButton->setEnabled(FALSE); file.close();}//定值修改;void BarForm::edit(){ ComboBox1->setEnabled(TRUE); ComboBox2->setEnabled(TRUE); CheckBox1->setEnabled(TRUE); savePushButton->setEnabled(TRUE);}void BarForm::Table(){ int i, j; QString str; Lbar = Bar_Table->currentRow(); if ( Bar[Lbar][0] == "" || Bar[Lbar][1] == ""){ ComboBox1->setCurrentItem(0); ComboBox2->setCurrentItem(0); }else { i = atoi ( Bar[Lbar][0] ); ComboBox1->setCurrentItem(i); j = atoi ( Bar[Lbar][1] ); ComboBox2->setCurrentItem(j); } if ( Bar[Lbar][2] == "0" || Bar[Lbar][2] == "" ){ CheckBox1->setChecked(FALSE); }else if ( Bar[Lbar][2] == "1" ){ CheckBox1->setChecked(TRUE); }}//定值保存;void BarForm::save(){ int i, j; QString str, str1, str2; QDir::setCurrent("/root/FaultRecorder/"); QFile file( "bar_ratedvalue.DAT" ); file.open( IO_WriteOnly ); QTextStream stream( &file ); i = ComboBox1->currentItem(); j = ComboBox2->currentItem(); if ( i != 0 && j != 0 ){ Bar[Lbar][0] = QString("%0").arg(i, 0, 'f', 0); str1 = ComboBox1->text(i); Bar[Lbar][1] = QString("%0").arg(j, 0, 'f', 0); str2 = ComboBox2->text(j); }else { Bar[Lbar][0] = ""; Bar[Lbar][1] = ""; str1 = ""; str2 = ""; } Bar_Table->setText(Lbar, 0, str1+" "+str2); //显示母线名称; if( CheckBox1->isChecked() ){ Bar[Lbar][2] = "1"; str = CheckBox1->text(); }else if ( i != 0 && j != 0 ){ Bar[Lbar][2] = "0"; str = ""; }else { Bar[Lbar][2] = ""; str = ""; } Bar_Table->setText(Lbar, 1, str); //显示运行状态; for ( i = 0; i < 16; i++ ){ for ( j = 0; j < 3; j++){ stream<<Bar[i][j]; stream<<" "; } stream<<"\n"; } ComboBox1->setEnabled(FALSE); ComboBox2->setEnabled(FALSE); CheckBox1->setEnabled(FALSE); savePushButton->setEnabled(FALSE); file.close();}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -