ericV
14th August 2009, 15:18
Hi,
I'm attempting to write a simple popup dialog to set up the Hostname and Port for a network connection. I dont really feel like writing a subclass for this, but its turning out to be harder than i thought.
My problem is that i want the "Save" button to remain disabled until both Validators return acceptable. Here an snippet of the execution block:
while(setupDialog->exec())
{
tempHost = hostT->text();
tempPort = portT->text();
saveButton->setDisabled(portValidator->validate(tempPort,pos)
==QValidator::Acceptable &&
hostIPValidator->validate(tempHost,pos)
==QValidator::Acceptable);
}
if(setupDialog->result() ==QDialog::Accepted)
{
setHostAndPort(hostT->text(),portT->text().toInt());
}
this code is runs, but the save button is Enabled at the start and only gets Disabled if i make a wrong input and after correcting the input it does not become Enabled...
I'm attempting to write a simple popup dialog to set up the Hostname and Port for a network connection. I dont really feel like writing a subclass for this, but its turning out to be harder than i thought.
My problem is that i want the "Save" button to remain disabled until both Validators return acceptable. Here an snippet of the execution block:
while(setupDialog->exec())
{
tempHost = hostT->text();
tempPort = portT->text();
saveButton->setDisabled(portValidator->validate(tempPort,pos)
==QValidator::Acceptable &&
hostIPValidator->validate(tempHost,pos)
==QValidator::Acceptable);
}
if(setupDialog->result() ==QDialog::Accepted)
{
setHostAndPort(hostT->text(),portT->text().toInt());
}
this code is runs, but the save button is Enabled at the start and only gets Disabled if i make a wrong input and after correcting the input it does not become Enabled...