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:

Qt Code:
  1. while(setupDialog->exec())
  2. {
  3. tempHost = hostT->text();
  4. tempPort = portT->text();
  5.  
  6. saveButton->setDisabled(portValidator->validate(tempPort,pos)
  7. ==QValidator::Acceptable &&
  8. hostIPValidator->validate(tempHost,pos)
  9. ==QValidator::Acceptable);
  10. }
  11. if(setupDialog->result() ==QDialog::Accepted)
  12. {
  13. setHostAndPort(hostT->text(),portT->text().toInt());
  14.  
  15. }
To copy to clipboard, switch view to plain text mode 

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...