Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Toutes les fonctions  ·  Vues d'ensemble  · 

Obsolete Members for QMessageBox

The following class members are obsolete. They are provided to keep old source code working. We strongly advise against using them in new code.

Public Types

typedef Button   (obsolete)

Public Functions

QMessageBox ( const QString & title, const QString & text, Icon icon, int button0, int button1, int button2, QWidget * parent = 0, Qt::WindowFlags f = Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint )   (obsolete)
QString buttonText ( int button ) const   (obsolete)
void setButtonText ( int button, const QString & text )   (obsolete)
  • 4 public functions inherited from QDialog
  • 3 public functions inherited from QWidget

Static Public Members

int critical ( QWidget * parent, const QString & title, const QString & text, int button0, int button1, int button2 = 0 )   (obsolete)
int critical ( QWidget * parent, const QString & title, const QString & text, const QString & button0Text, const QString & button1Text = QString(), const QString & button2Text = QString(), int defaultButtonNumber = 0, int escapeButtonNumber = -1 )   (obsolete)
int information ( QWidget * parent, const QString & title, const QString & text, int button0, int button1 = 0, int button2 = 0 )   (obsolete)
int information ( QWidget * parent, const QString & title, const QString & text, const QString & button0Text, const QString & button1Text = QString(), const QString & button2Text = QString(), int defaultButtonNumber = 0, int escapeButtonNumber = -1 )   (obsolete)
int question ( QWidget * parent, const QString & title, const QString & text, int button0, int button1 = 0, int button2 = 0 )   (obsolete)
int question ( QWidget * parent, const QString & title, const QString & text, const QString & button0Text, const QString & button1Text = QString(), const QString & button2Text = QString(), int defaultButtonNumber = 0, int escapeButtonNumber = -1 )   (obsolete)
QPixmap standardIcon ( Icon icon )   (obsolete)
int warning ( QWidget * parent, const QString & title, const QString & text, int button0, int button1, int button2 = 0 )   (obsolete)
int warning ( QWidget * parent, const QString & title, const QString & text, const QString & button0Text, const QString & button1Text = QString(), const QString & button2Text = QString(), int defaultButtonNumber = 0, int escapeButtonNumber = -1 )   (obsolete)

Member Type Documentation

typedef QMessageBox::Button

Use QMessageBox::StandardButton instead.


Member Function Documentation

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

Constructs a message box with a title, a text, an icon, and up to three buttons.

The icon must be one of the following:

Each button, button0, button1 and button2, can have one of the following values:

Use QMessageBox::NoButton for the later parameters to have fewer than three buttons in your message box. If you don't specify any buttons at all, QMessageBox will provide an Ok button.

One of the buttons can be OR-ed with the QMessageBox::Default flag to make it the default button (clicked when Enter is pressed).

One of the buttons can be OR-ed with the QMessageBox::Escape flag to make it the cancel or close button (clicked when Esc is pressed).

         QMessageBox mb("Application Name",
                        "Hardware failure.\n\nDisk error detected\nDo you want to stop?",
                        QMessageBox::Question,
                        QMessageBox::Yes | QMessageBox::Default,
                        QMessageBox::No | QMessageBox::Escape,
                        QMessageBox::NoButton);
         if (mb.exec() == QMessageBox::No) {
             // try again

If parent is 0, the message box is an application modal dialog box. If parent is a widget, the message box is window modal relative to parent.

The parent and f arguments are passed to the QDialog constructor.

See also setWindowTitle(), setText(), and setIcon().

QString QMessageBox::buttonText ( int button ) const

Returns the text of the message box button button, or an empty string if the message box does not contain the button.

Use button() and QPushButton::text() instead.

See also setButtonText().

int QMessageBox::critical ( QWidget * parent, const QString & title, const QString & text, int button0, int button1, int button2 = 0 )   [static]

Opens a critical message box with the given title and text. The dialog may have up to three buttons. Each of the button parameters, button0, button1 and button2 may be set to one of the following values:

If you don't want all three buttons, set the last button, or last two buttons to QMessageBox::NoButton.

One button can be OR-ed with QMessageBox::Default, and one button can be OR-ed with QMessageBox::Escape.

Returns the identity (QMessageBox::Ok, or QMessageBox::No, etc.) of the button that was clicked.

If parent is 0, the message box is an application modal dialog box. If parent is a widget, the message box is window modal relative to parent.

Warning: Do not delete parent during the execution of the dialog. If you want to do this, you should create the dialog yourself using one of the QMessageBox constructors.

See also information(), question(), and warning().

int QMessageBox::critical ( QWidget * parent, const QString & title, const QString & text, const QString & button0Text, const QString & button1Text = QString(), const QString & button2Text = QString(), int defaultButtonNumber = 0, int escapeButtonNumber = -1 )   [static]

This is an overloaded function.

Displays a critical error message box with the given title and text, as well as one, two, or three buttons. Returns the number of the button that was clicked (0, 1 or 2).

button0Text is the text of the first button, and is optional. If button0Text is not supplied, "OK" (translated) will be used. button1Text is the text of the second button, and is optional, and button2Text is the text of the third button, and is optional. defaultButtonNumber (0, 1 or 2) is the index of the default button; pressing Return or Enter is the same as clicking the default button. It defaults to 0 (the first button). escapeButtonNumber is the index of the Escape button; pressing Escape is the same as clicking this button. It defaults to -1; supply 0, 1, or 2 to make pressing Escape equivalent to clicking the relevant button.

If parent is 0, the message box is an application modal dialog box. If parent is a widget, the message box is window modal relative to parent.

Warning: Do not delete parent during the execution of the dialog. If you want to do this, you should create the dialog yourself using one of the QMessageBox constructors.

See also information(), question(), and warning().

int QMessageBox::information ( QWidget * parent, const QString & title, const QString & text, int button0, int button1 = 0, int button2 = 0 )   [static]

Opens an information message box with the given title and the text. The dialog may have up to three buttons. Each of the buttons, button0, button1 and button2 may be set to one of the following values:

If you don't want all three buttons, set the last button, or last two buttons to QMessageBox::NoButton.

One button can be OR-ed with QMessageBox::Default, and one button can be OR-ed with QMessageBox::Escape.

Returns the identity (QMessageBox::Ok, or QMessageBox::No, etc.) of the button that was clicked.

If parent is 0, the message box is an application modal dialog box. If parent is a widget, the message box is window modal relative to parent.

Warning: Do not delete parent during the execution of the dialog. If you want to do this, you should create the dialog yourself using one of the QMessageBox constructors.

See also question(), warning(), and critical().

int QMessageBox::information ( QWidget * parent, const QString & title, const QString & text, const QString & button0Text, const QString & button1Text = QString(), const QString & button2Text = QString(), int defaultButtonNumber = 0, int escapeButtonNumber = -1 )   [static]

This is an overloaded function.

Displays an information message box with the given title and text, as well as one, two or three buttons. Returns the index of the button that was clicked (0, 1 or 2).

button0Text is the text of the first button, and is optional. If button0Text is not supplied, "OK" (translated) will be used. button1Text is the text of the second button, and is optional. button2Text is the text of the third button, and is optional. defaultButtonNumber (0, 1 or 2) is the index of the default button; pressing Return or Enter is the same as clicking the default button. It defaults to 0 (the first button). escapeButtonNumber is the index of the escape button; pressing Esc is the same as clicking this button. It defaults to -1; supply 0, 1 or 2 to make pressing Esc equivalent to clicking the relevant button.

If parent is 0, the message box is an application modal dialog box. If parent is a widget, the message box is window modal relative to parent.

Warning: Do not delete parent during the execution of the dialog. If you want to do this, you should create the dialog yourself using one of the QMessageBox constructors.

See also question(), warning(), and critical().

int QMessageBox::question ( QWidget * parent, const QString & title, const QString & text, int button0, int button1 = 0, int button2 = 0 )   [static]

Opens a question message box with the given title and text. The dialog may have up to three buttons. Each of the buttons, button0, button1 and button2 may be set to one of the following values:

If you don't want all three buttons, set the last button, or last two buttons to QMessageBox::NoButton.

One button can be OR-ed with QMessageBox::Default, and one button can be OR-ed with QMessageBox::Escape.

Returns the identity (QMessageBox::Yes, or QMessageBox::No, etc.) of the button that was clicked.

If parent is 0, the message box is an application modal dialog box. If parent is a widget, the message box is window modal relative to parent.

Warning: Do not delete parent during the execution of the dialog. If you want to do this, you should create the dialog yourself using one of the QMessageBox constructors.

See also information(), warning(), and critical().

int QMessageBox::question ( QWidget * parent, const QString & title, const QString & text, const QString & button0Text, const QString & button1Text = QString(), const QString & button2Text = QString(), int defaultButtonNumber = 0, int escapeButtonNumber = -1 )   [static]

This is an overloaded function.

Displays a question message box with the given title and text, as well as one, two or three buttons. Returns the index of the button that was clicked (0, 1 or 2).

button0Text is the text of the first button, and is optional. If button0Text is not supplied, "OK" (translated) will be used. button1Text is the text of the second button, and is optional. button2Text is the text of the third button, and is optional. defaultButtonNumber (0, 1 or 2) is the index of the default button; pressing Return or Enter is the same as clicking the default button. It defaults to 0 (the first button). escapeButtonNumber is the index of the Escape button; pressing Escape is the same as clicking this button. It defaults to -1; supply 0, 1 or 2 to make pressing Escape equivalent to clicking the relevant button.

If parent is 0, the message box is an application modal dialog box. If parent is a widget, the message box is window modal relative to parent.

Warning: Do not delete parent during the execution of the dialog. If you want to do this, you should create the dialog yourself using one of the QMessageBox constructors.

See also information(), warning(), and critical().

void QMessageBox::setButtonText ( int button, const QString & text )

Sets the text of the message box button button to text. Setting the text of a button that is not in the message box is silently ignored.

Use addButton() instead.

See also buttonText().

QPixmap QMessageBox::standardIcon ( Icon icon )   [static]

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::Question, QMessageBox::Information, QMessageBox::Warning or QMessageBox::Critical.

Call QStyle::standardIcon() with QStyle::SP_MessageBoxInformation etc. instead.

int QMessageBox::warning ( QWidget * parent, const QString & title, const QString & text, int button0, int button1, int button2 = 0 )   [static]

Opens a warning message box with the given title and text. The dialog may have up to three buttons. Each of the button parameters, button0, button1 and button2 may be set to one of the following values:

If you don't want all three buttons, set the last button, or last two buttons to QMessageBox::NoButton.

One button can be OR-ed with QMessageBox::Default, and one button can be OR-ed with QMessageBox::Escape.

Returns the identity (QMessageBox::Ok or QMessageBox::No or ...) of the button that was clicked.

If parent is 0, the message box is an application modal dialog box. If parent is a widget, the message box is window modal relative to parent.

Warning: Do not delete parent during the execution of the dialog. If you want to do this, you should create the dialog yourself using one of the QMessageBox constructors.

See also information(), question(), and critical().

int QMessageBox::warning ( QWidget * parent, const QString & title, const QString & text, const QString & button0Text, const QString & button1Text = QString(), const QString & button2Text = QString(), int defaultButtonNumber = 0, int escapeButtonNumber = -1 )   [static]

This is an overloaded function.

Displays a warning message box with the given title and text, as well as one, two, or three buttons. Returns the number of the button that was clicked (0, 1, or 2).

button0Text is the text of the first button, and is optional. If button0Text is not supplied, "OK" (translated) will be used. button1Text is the text of the second button, and is optional, and button2Text is the text of the third button, and is optional. defaultButtonNumber (0, 1 or 2) is the index of the default button; pressing Return or Enter is the same as clicking the default button. It defaults to 0 (the first button). escapeButtonNumber is the index of the Escape button; pressing Escape is the same as clicking this button. It defaults to -1; supply 0, 1, or 2 to make pressing Escape equivalent to clicking the relevant button.

If parent is 0, the message box is an application modal dialog box. If parent is a widget, the message box is window modal relative to parent.

Warning: Do not delete parent during the execution of the dialog. If you want to do this, you should create the dialog yourself using one of the QMessageBox constructors.

See also information(), question(), and critical().

Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 103
  2. Pourquoi les programmeurs sont-ils moins payés que les gestionnaires de programmes ? Manquent-ils de pouvoir de négociation ? 56
  3. «Le projet de loi des droits du développeur» : quelles conditions doivent remplir les entreprises pour que le développeur puisse réussir ? 93
  4. Les développeurs détestent-ils les antivirus ? Un programmeur manifeste sa haine envers ces solutions de sécurité 32
  5. Qt Commercial : Digia organise un webinar gratuit le 27 mars sur la conception d'interfaces utilisateur et d'applications avec le framework 0
  6. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  7. 2017 : un quinquennat pour une nouvelle version du C++ ? Possible, selon Herb Sutter 11
Page suivante
  1. Linus Torvalds : le "C++ est un langage horrible", en justifiant le choix du C pour le système de gestion de version Git 100
  2. Comment prendre en compte l'utilisateur dans vos applications ? Pour un développeur, « 90 % des utilisateurs sont des idiots » 231
  3. Quel est LE livre que tout développeur doit lire absolument ? Celui qui vous a le plus marqué et inspiré 96
  4. Apple cède et s'engage à payer des droits à Nokia, le conflit des brevets entre les deux firmes s'achève 158
  5. Nokia porte à nouveau plainte contre Apple pour violation de sept nouveaux brevets 158
  6. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 103
  7. Quel est le code dont vous êtes le plus fier ? Pourquoi l'avez-vous écrit ? Et pourquoi vous a-t-il donné autant de satisfaction ? 83
Page suivante

Le blog Digia au hasard

Logo

Créer des applications avec un style Metro avec Qt, exemples en QML et C++, un article de Digia Qt traduit par Thibaut Cuvelier

Le blog Digia est l'endroit privilégié pour la communication sur l'édition commerciale de Qt, où des réponses publiques sont apportées aux questions les plus posées au support. Lire l'article.

Communauté

Ressources

Liens utiles

Contact

  • Vous souhaitez rejoindre la rédaction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

Qt dans le magazine

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 4.6-snapshot
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web