📄 ruledlg.cpp
字号:
/****************************************************************************** Form implementation generated from reading ui file 'ruledlg.ui'**** Created by: The User Interface Compiler ($Id: qt/main.cpp 3.3.6 edited Aug 31 2005 $)**** WARNING! All changes made in this file will be lost!****************************************************************************/#include <qpushbutton.h>#include <qcheckbox.h>#include <qradiobutton.h>#include <qbuttongroup.h>#include "ruledlg.h"/* * Constructs a QRuleDlg as a child of 'parent', with the * name 'name' and widget flags set to 'f'. * * The dialog will by default be modeless, unless you set 'modal' to * TRUE to construct a modal dialog. */QRuleDlg::QRuleDlg( QWidget* parent, const char* name, bool modal, WFlags fl ) : QDialog( parent, name, modal, fl ){ if ( !name ) setName( "QRuleDlg" ); setMaximumSize( QSize( 300, 200 ) ); selectId = -1; okButton = new QPushButton( this, "okButton" ); okButton->setGeometry( QRect( 180, 130, 60, 26 ) ); connect( okButton, SIGNAL(clicked()), this, SLOT(okClick()) ); cancelButton = new QPushButton( this, "cancelButton" ); cancelButton->setGeometry( QRect( 100, 130, 60, 26 ) ); connect( cancelButton, SIGNAL(clicked()), this, SLOT(reject ()) ); mode_sel = new QButtonGroup( this, "mode_select" ); mode_sel->setGeometry( QRect( 20, 10, 220, 110 ) ); mode_sel->setRadioButtonExclusive( TRUE ); connect( mode_sel,SIGNAL(clicked(int)),this,SLOT(buttonClick(int)) ); radioButton1 = new QRadioButton( mode_sel, "radioButton1" ); radioButton1->setGeometry( QRect( 60, 20, 90, 22 ) ); radioButton1->setChecked( TRUE ); radioButton2 = new QRadioButton( mode_sel, "radioButton2" ); radioButton2->setGeometry( QRect( 60, 50, 110, 22 ) ); checkBox1 = new QCheckBox( mode_sel, "checkBox1" ); checkBox1->setGeometry( QRect( 80, 80, 90, 22 ) ); checkBox1->setDisabled(true); languageChange(); resize( QSize(262, 170).expandedTo(minimumSizeHint()) ); clearWState( WState_Polished );}/* * Destroys the object and frees any allocated resources */QRuleDlg::~QRuleDlg(){ // no need to delete child widgets, Qt does it all for us}void QRuleDlg::okClick(){ QDialog::done(selectId);}void QRuleDlg::setCurSatus(int s){ switch(s) { case 1: checkBox1->setDisabled(true); radioButton1->setChecked(true); radioButton2->setChecked(false); break; case 2: checkBox1->setDisabled(false); radioButton2->setChecked(true); radioButton1->setChecked(false); break; case 3: checkBox1->setDisabled(false); checkBox1->setChecked(true); radioButton2->setChecked(true); radioButton1->setChecked(false); break; }}void QRuleDlg::buttonClick(int id){ selectId=id+1; switch(selectId) { case 1: checkBox1->setDisabled(true); break; case 2: checkBox1->setDisabled(false); if(checkBox1->isChecked()) selectId =3; break; case 3: if(!checkBox1->isChecked()) selectId =2; break; }}/* * Sets the strings of the subwidgets using the current * language. */void QRuleDlg::languageChange(){ setCaption( tr( "Rule-Setting" ) ); setIconText( QString::null ); okButton->setText( tr( "&ok" ) ); cancelButton->setText( tr( "&cancel" ) ); mode_sel->setTitle( tr( "mode" ) ); checkBox1->setText( tr( "&HUMAN-ET" ) ); radioButton2->setText( tr( "&playkilling" ) ); radioButton1->setText( tr( "&friendly" ) );}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -