I contacted Trolltech support. In case anyone searches this thread for a similar problem, I thought I'd send the resolution. It is not necessary to create one's own ok/cancel buttons, although that would probably work (I didn't try that). It is also not necessary to enable/disable the ok/cancel buttons, but that is a good idea (I didn't try that either). A simpler solution is to override the done() method and do the validation there. To make the dialog disappear, just call the parent's done() method. To keep the dialog on the screen, simply return. Here's some code...
Thanks for the ideas,
Joel 
void DataSourceDlg::done(int r)
{
if(QDialog::Accepted == r
) // ok was pressed {
if(nodeLineEdit->text().size() > 3) // validate the data somehow
{
return;
}
else
{
statusBar->setText("Invalid data in text edit...try again...");
return;
}
}
else // cancel, close or exc was pressed
{
return;
}
}
void DataSourceDlg::done(int r)
{
if(QDialog::Accepted == r) // ok was pressed
{
if(nodeLineEdit->text().size() > 3) // validate the data somehow
{
QDialog::done(r);
return;
}
else
{
statusBar->setText("Invalid data in text edit...try again...");
return;
}
}
else // cancel, close or exc was pressed
{
QDialog::done(r);
return;
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks