×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Jan 2011
    Posts
    192

    Question qmessagebox problem

    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;
    }

  2. #2
    Regular Contributor
    Join Date
    Oct 2007
    Location
    India
    Posts
    349

    Re: qmessagebox problem

    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();

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×