- 重大な情報を伝える。
QMessageBox::critical( 0, "Application name here",
QString("重大なエラーがおきました。 ") );
- 警告を伝える。Retry を Ok Abort をCancel にもできる。
switch( QMessageBox::warning( this, "Application name here",
"Could not save the user preferences,?n"
"because the disk is full. You can delete?n"
"some files and press Retry, or you can?n"
"abort the Save Preferences operation.",
QMessageBox::Retry | QMessageBox::Default,
QMessageBox::Abort | QMessageBox::Escape )) {
case QMessageBox::Retry: // Retry clicked or Enter pressed
// try again
break;
case QMessageBox::Abort: // Abort clicked or Escape pressed
// abort
break;
}
- aboutを表示する。
QMessageBox::about( this, "About <Application>",
"<Application> is a <one-paragraph blurb>?n?n"
"Copyright 1991-2003 Such-and-such. "
"<License words here.>?n?n"
"For technical support, call 1234-56789 or see?n"
"http://www.such-and-such.com/Application/?n" );
- progressbar を表示する。
QProgressDialog* pgbar = new QProgressDialog("now...", "Cancel",0, 100) ;
pgbar->show() ;
for (int i=0; i<101; i++) pgbar->setValue(i) ;