[Qt-interest] Unable to display QErrorMessage in modal dialog

Sean Harmer sean.harmer at maps-technology.com
Thu Jun 11 15:09:35 CEST 2009


On Thursday 11 Jun 2009 13:44:30 Stephen Collyer wrote:
> I have the following code which is called after an OK button is
> clicked, in a modal dialog:
>
> void InstallAgentSSLCertDlg::check_passphrase_data()
> {
>     QString pp_str  = passphrase->text();
>     QString cpp_str = confirm_passphrase->text();
>
>     if (! pp_str.isEmpty() || ! cpp_str.isEmpty() &&
>         (pp_str != cpp_str))
>     {
>         QErrorMessage error;
>         error.showMessage(tr("The passphrase and confirmation differ"));
>     }
>     else
>     {
>         accept();
>     }
> }
>
> I never see the QErrorMessage if the true branch of the if
> is taken. Can anyone tell me why this doesn't work ?
Do you have any other QErrorMessage objects open displaying other errors? The 
docs talk about them being queued in this case.

Alternatively, have you shown this error message before and unselected the 
"Show this message again" checkbox?

Cheers,

Sean



More information about the Qt-interest-old mailing list