Yeah, I had updated that myself after submitting, but thanks for catching it. The actual version of the if statement is shown in the following code block. validSelection() only returns a bool that was already figured out before this point, but it's better this way, because validSelection() never gets called if the type isn't EnabledChange, and if the button isn't currently enabled:

Qt Code:
  1. if (obj == myOpenButton)
  2. {
  3. if (event->type() == QEvent::EnabledChange &&
  4. myOpenButton->isEnabled() &&
  5. !validSelection())
  6. {
  7. // don't allow QFileDialog to alter the state of the
  8. // Open button. This is to be handled locally in the
  9. // MyFileDialog::fileSelectionChanged() function.
  10. myOpenButton->setEnabled(false);
  11. return true;
  12. }
  13. else
  14. return false;
  15. }
To copy to clipboard, switch view to plain text mode