Compatibility Members for QMessageBox

以下成员源于类 QMessageBox are part of the Qt compatibility layer. We advise against using them in new code.

公共函数

QMessageBox (const QString & title , const QString & text , Icon icon , int button0 , int button1 , int button2 , QWidget * parent , const char * name , bool modal , Qt::WindowFlags f = Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint)
QMessageBox (QWidget * parent , const char * name )

静态公共成员

int message (const QString & title , const QString & text , const QString & buttonText = QString(), QWidget * parent = 0, const char * name = 0)
QPixmap standardIcon (Icon icon , Qt::GUIStyle style )

成员函数文档编制

QMessageBox:: QMessageBox (const QString & title , const QString & text , 图标 icon , int button0 , int button1 , int button2 , QWidget * parent , const char * name , bool modal , Qt::WindowFlags f = Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint)

Constructs a message box with the given parent , name , and window flags, f . The window title is specified by title , and the message box displays message text and an icon specified by text and icon .

The buttons that the user can access to respond to the message are defined by button0 , button1 ,和 button2 .

QMessageBox:: QMessageBox ( QWidget * parent , const char * name )

Constructs a message box with the given parent and name .

[static] int QMessageBox:: message (const QString & title , const QString & text , const QString & buttonText = QString(), QWidget * parent = 0, const char * name = 0)

Opens a modal message box with the given title and showing the given text . The message box has a single button which has the given buttonText (or tr("OK")). The message box is centred over its parent and is called name .

使用 information (), warning (), question (),或 critical () 代替。

例如,若有代码像

QMessageBox::message(tr("My App"), tr("All occurrences replaced."),
                     tr("Close"), this);
					

可以把它重写成

QMessageBox::information(this, tr("My App"),
                         tr("All occurrences replaced."),
                         QMessageBox::Close);
					

[static] QPixmap QMessageBox:: standardIcon ( 图标 icon , Qt::GUIStyle style )

Returns the pixmap used for a standard icon. This allows the pixmaps to be used in more complex message boxes. icon specifies the required icon, e.g. QMessageBox::Information , QMessageBox::Warning or QMessageBox::Critical .

style is unused.