QMessageBox und QT

Einfache MessageBox

QMessageBox msgBox;
msgBox.setText("The document has been modified.");
msgBox.exec();

MessageBox mit Untertext

QMessageBox msgBox;
msgBox.setText("The document has been modified.");
msgBox.setInformativeText("Do you want to save your changes?"); 
msgBox.exec();

Ja/Nein Abfrage

QMessageBox msgBox;
msgBox.setText(tr("File exists, overwrite?"));
msgBox.setDefaultButton(QMessageBox::Yes);  
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
if (msgBox.exec() != QMessageBox::Yes)
{
    return false;
}


Datenschutzerklärung | Impressum