rahulgogoi
6th June 2011, 08:11
hello friends
Actually i have two lineEdit,one gridlayout and a radio button..what i want to do is on checked of radio button i want to put my first LineEdit in the grid layout..and on unchecked of radio button i want to put my second lineEdit in gridlayout..but when i exexute my code..both my lineEdit is palced in two gridlayout..althoug there is only one gridlayout….the code i have wrriten is…
.
SettingForm::SettingForm(QWidget *parent) :QDialog(parent),ui(new Ui::SettingForm)
{
ui->setupUi(this);
pEditPassEnable=new QLineEdit;
pEditPassDisable=new QLineEdit;
connect(ui->passwordRadiobutton,SIGNAL(toggled(bool)),this,SLO T(onCheckRadioButton(bool)));
}
bool SettingForm::onCheckRadioButton(bool checked)
{
if(checked)
{
pEditPassEnable->setText("Click to change Password");
pEditPassEnable->setEnabled(true);
pEditPassEnable->setStyleSheet("Color:rgb(255, 255, 255);");
pEditPassEnable->setStyleSheet("background-color: rgb(206, 218, 214);");
ui->PassgridLayout->addWidget(pEditPassEnable);
}
else if(!checked)
{
pEditPassDisable->setEchoMode(QLineEdit::Normal);
pEditPassDisable->setText("Set Password");
pEditPassDisable->setEnabled(false);
pEditPassDisable->setStyleSheet("Color:rgb(128, 128, 128);");
pEditPassDisable->setStyleSheet("background-color: rgb(206, 218, 214);");
ui->PassgridLayout->addWidget(pEditPassDisable);
}
return true;
}
can anyone please suggest me what mistake i have done in my code
regards
Rahul
Actually i have two lineEdit,one gridlayout and a radio button..what i want to do is on checked of radio button i want to put my first LineEdit in the grid layout..and on unchecked of radio button i want to put my second lineEdit in gridlayout..but when i exexute my code..both my lineEdit is palced in two gridlayout..althoug there is only one gridlayout….the code i have wrriten is…
.
SettingForm::SettingForm(QWidget *parent) :QDialog(parent),ui(new Ui::SettingForm)
{
ui->setupUi(this);
pEditPassEnable=new QLineEdit;
pEditPassDisable=new QLineEdit;
connect(ui->passwordRadiobutton,SIGNAL(toggled(bool)),this,SLO T(onCheckRadioButton(bool)));
}
bool SettingForm::onCheckRadioButton(bool checked)
{
if(checked)
{
pEditPassEnable->setText("Click to change Password");
pEditPassEnable->setEnabled(true);
pEditPassEnable->setStyleSheet("Color:rgb(255, 255, 255);");
pEditPassEnable->setStyleSheet("background-color: rgb(206, 218, 214);");
ui->PassgridLayout->addWidget(pEditPassEnable);
}
else if(!checked)
{
pEditPassDisable->setEchoMode(QLineEdit::Normal);
pEditPassDisable->setText("Set Password");
pEditPassDisable->setEnabled(false);
pEditPassDisable->setStyleSheet("Color:rgb(128, 128, 128);");
pEditPassDisable->setStyleSheet("background-color: rgb(206, 218, 214);");
ui->PassgridLayout->addWidget(pEditPassDisable);
}
return true;
}
can anyone please suggest me what mistake i have done in my code
regards
Rahul