Judd
5th August 2009, 06:12
Hello,
I have a QWizard class with a number of QLineEdit's. I've registered the QLineEdits as such:
registerField("companyName*", companynameLineEdit);
registerField("firstname*", firstnameLineEdit);
registerField("lastname*", lastnameLineEdit);
The problem I have is, if I set all of these fields to mandatory, then all the fields have to be entered. However, in my program, any one of these fields needs to enable the 'Next' pushbutton. I've tried connecting the textChanged() signals of the QLineEdits, and connecting them to a slot which then iterates over the text of the QLineEdits: My function is:
void ClassInfoPage::textChanged(const QString & text)
{
if(companyNameLineEdit->text()!="")
registerField("companyName", companyNameLineEdit);
else
registerField("companyName*", companyNameLineEdit);
if(firstnameLineEdit->text()!="")
registerField("firstname", firstnameLineEdit);
else
registerField("firstname*", firstnameLineEdit);
if(lastnameLineEdit->text()!="")
registerField("lastname", lastnameLineEdit);
else
registerField("lastname*", lastnameLineEdit);
}
This, of course doesn't work. is there a way to de-register fields? Or is there a cleaner way to get the desired results? Any help would be appreciated. Thankyou
I have a QWizard class with a number of QLineEdit's. I've registered the QLineEdits as such:
registerField("companyName*", companynameLineEdit);
registerField("firstname*", firstnameLineEdit);
registerField("lastname*", lastnameLineEdit);
The problem I have is, if I set all of these fields to mandatory, then all the fields have to be entered. However, in my program, any one of these fields needs to enable the 'Next' pushbutton. I've tried connecting the textChanged() signals of the QLineEdits, and connecting them to a slot which then iterates over the text of the QLineEdits: My function is:
void ClassInfoPage::textChanged(const QString & text)
{
if(companyNameLineEdit->text()!="")
registerField("companyName", companyNameLineEdit);
else
registerField("companyName*", companyNameLineEdit);
if(firstnameLineEdit->text()!="")
registerField("firstname", firstnameLineEdit);
else
registerField("firstname*", firstnameLineEdit);
if(lastnameLineEdit->text()!="")
registerField("lastname", lastnameLineEdit);
else
registerField("lastname*", lastnameLineEdit);
}
This, of course doesn't work. is there a way to de-register fields? Or is there a cleaner way to get the desired results? Any help would be appreciated. Thankyou