hi,
i am facing a problem when customizing the QMessageBox.
i want a messagebox that appear with 2 buttons; the right button with the name "ssss" and the left one with the name "dddd".
i am using the following code, and only one button appears.
Any help please.
QMessageBox mb( "Application name here", "Do you want to choose ssss or dddd.\n",
QMessageBox::Information,
QMessageBox::Yes | QMessageBox:efault,
QMessageBox::No,
QMessageBox::Cancel | QMessageBox::Escape );
mb.setButtonText( QMessageBox::Yes, tr("ssss ") );
mb.setButtonText( QMessageBox::No, tr("dddd") );
switch( mb.exec() )
{
case QMessageBox::Yes:
//
break;
case QMessageBox::No:
//
break;
}
Try this:
QMessageBox msgBox;
msgBox.setText("Login Error");
msgBox.setIcon(QMessageBox::Information);
msgBox.setInformativeText("Enter the User Name or Password");
msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
msgBox.setDefaultButton(QMessageBox::Ok);
int ret = msgBox.exec();