Obsolete Members for QMessageBox
QMessageBox クラスの以下のメンバーは非推奨となっています。これらは、古いソースコードが引き続き動作するように提供されているものです。新しいコードでの使用は強く推奨しません。
パブリック型
(deprecated) | Button |
パブリック関数
(deprecated) | QMessageBox(const QString &title, const QString &text, QMessageBox::Icon icon, int button0, int button1, int button2, QWidget *parent = nullptr, Qt::WindowFlags f = Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint) |
(deprecated in 6.2) QString | buttonText(int button) const |
(deprecated in 6.2) void | setButtonText(int button, const QString &text) |
静的パブリックメンバー
(deprecated in 6.2) int | critical(QWidget *parent, const QString &title, const QString &text, int button0, int button1, int button2 = 0) |
(deprecated in 6.2) 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) |
(deprecated in 6.2) int | information(QWidget *parent, const QString &title, const QString &text, int button0, int button1 = 0, int button2 = 0) |
(deprecated in 6.2) 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) |
(deprecated in 6.2) int | question(QWidget *parent, const QString &title, const QString &text, int button0, int button1 = 0, int button2 = 0) |
(deprecated in 6.2) 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) |
(deprecated in 6.2) QPixmap | standardIcon(QMessageBox::Icon icon) |
(deprecated in 6.2) int | warning(QWidget *parent, const QString &title, const QString &text, int button0, int button1, int button2 = 0) |
(deprecated in 6.2) 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) |
メンバー型のドキュメント
[deprecated] QMessageBox::Button
この typedef は非推奨です。新しいコードでの使用は強く推奨しません。
代わりに `QMessageBox::StandardButton ` を使用してください。
メンバ関数のドキュメント
[deprecated] QMessageBox::QMessageBox(const QString &title, const QString &text, QMessageBox::Icon icon, int button0, int button1, int button2, QWidget *parent = nullptr, Qt::WindowFlags f = Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint)
この関数は非推奨です。新しいコードでの使用は強くお勧めしません。
title 、text 、icon 、および最大3つのボタンを備えたメッセージボックスを作成します。
icon は、以下のいずれかである必要があります:
- QMessageBox::NoIcon
- QMessageBox::Question
- QMessageBox::Information
- QMessageBox::Warning
- QMessageBox::Critical
各ボタン(button0 、button1 、button2 )には、次のいずれかの値を指定できます。
- QMessageBox::NoButton
- QMessageBox::Ok
- QMessageBox::Cancel
- QMessageBox::Yes
- QMessageBox::No
- QMessageBox::Abort
- QMessageBox::Retry
- QMessageBox::Ignore
- QMessageBox::YesAll
- QMessageBox::NoAll
メッセージボックス内のボタン数を3つ未満にするには、後続のパラメータにQMessageBox::NoButton を指定してください。ボタンを一切指定しない場合、QMessageBoxは「OK」ボタンを表示します。
いずれかのボタンにQMessageBox::Default フラグを OR 演算で組み合わせることで、そのボタンをデフォルトボタン(Enter キーを押したときにクリックされるボタン)に設定できます。
ボタンのいずれかにQMessageBox::Escape フラグをOR結合することで、そのボタンを[キャンセル]または[閉じる]ボタン(Esc キーが押されたときにクリックされる)に設定できます。
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メッセージボックスは、application modal ダイアログボックスです。
parent およびf の引数は、QDialog のコンストラクタに渡されます。
「 setWindowTitle()」、「setText()」、および「setIcon()」も参照してください 。
[deprecated in 6.2] QString QMessageBox::buttonText(int button) const
この関数はバージョン 6.2 以降、非推奨となっています。新しいコードでの使用は強く推奨しません。
メッセージボックスのボタン「button 」のテキストを返します。メッセージボックスにこのボタンが含まれていない場合は、空の文字列を返します。
代わりに、button() およびQPushButton::text() を使用してください。
setButtonText()も参照してください 。
[static, deprecated in 6.2] int QMessageBox::critical(QWidget *parent, const QString &title, const QString &text, int button0, int button1, int button2 = 0)
この関数はバージョン 6.2 以降、非推奨となっています。新しいコードでの使用は強く推奨しません。
代わりに、StandardButtons を受け取るオーバーロードを使用してください。
指定されたtitle およびtext を使用して、重要度「critical」のメッセージボックスを開きます。ダイアログには最大3つのボタンが表示される場合があります。各ボタンパラメータであるbutton0 、button1 、button2 は、以下のいずれかの値に設定できます。
- QMessageBox::NoButton
- QMessageBox::Ok
- QMessageBox::Cancel
- QMessageBox::Yes
- QMessageBox::No
- QMessageBox::Abort
- QMessageBox::Retry
- QMessageBox::Ignore
- QMessageBox::YesAll
- QMessageBox::NoAll
3つのボタンをすべて表示したくない場合は、最後のボタン、または最後の2つのボタンをQMessageBox::NoButton に設定してください。
1つのボタンはQMessageBox::Default とOR演算で結合でき、もう1つのボタンはQMessageBox::Escape とOR演算で結合できます。
クリックされたボタンの識別子(QMessageBox::Ok 、QMessageBox::No など)を返します。
メッセージボックスは、application modal ダイアログボックスです。
警告: ダイアログの実行中は、parent を削除しないでください 。削除したい場合は、QMessageBox のコンストラクタのいずれかを使用して、ダイアログを自分で作成する必要があります。
information()、question()、およびwarning()も参照してください 。
[static, deprecated in 6.2] 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)
この関数はバージョン 6.2 以降、非推奨となっています。新しいコードでの使用は強く推奨しません。
代わりに、StandardButtons を受け取るオーバーロードを使用してください。
指定されたtitle およびtext を含む重大なエラーメッセージボックスと、1つ、2つ、または3つのボタンを表示します。クリックされたボタンの番号(0、1、または2)を返します。
button0Text は最初のボタンのテキストであり、省略可能です。button0Text が指定されていない場合は、「OK」(翻訳済み)が使用されます。button1Text は2番目のボタンのテキストであり、省略可能です。また、button2Text は3番目のボタンのテキストであり、省略可能です。defaultButtonNumber (0、1、または2) はデフォルトボタンのインデックスです。Return キーまたは Enter キーを押すと、デフォルトボタンをクリックしたのと同じ動作になります。デフォルトは 0(最初のボタン)です。escapeButtonNumber は Escape ボタンのインデックスです。Escape キーを押すと、このボタンをクリックしたのと同じ動作になります。 デフォルトは -1 です。Esc キーを押すと対応するボタンがクリックされたのと同じ動作にするには、0、1、または 2 を指定してください。
メッセージボックスは、application modal のダイアログボックスです。
警告: ダイアログの実行中に `parent `を削除しないでください 。削除したい場合は、QMessageBox のコンストラクタのいずれかを使用して、自分でダイアログを作成してください。
これはオーバーロードされた関数です。
information()、question()、およびwarning()も参照してください 。
[static, deprecated in 6.2] int QMessageBox::information(QWidget *parent, const QString &title, const QString &text, int button0, int button1 = 0, int button2 = 0)
この関数はバージョン 6.2 以降、非推奨となっています。新しいコードでの使用は強く推奨しません。
代わりに、StandardButtons を引数とするオーバーロードを使用してください。
指定されたtitle とtext を含む情報メッセージボックスを開きます。ダイアログには最大3つのボタンが表示されます。各ボタン(button0 、button1 、button2 )は、以下のいずれかの値に設定できます。
- QMessageBox::NoButton
- QMessageBox::Ok
- QMessageBox::Cancel
- QMessageBox::Yes
- QMessageBox::No
- QMessageBox::Abort
- QMessageBox::Retry
- QMessageBox::Ignore
- QMessageBox::YesAll
- QMessageBox::NoAll
3つのボタンをすべて表示したくない場合は、最後のボタン、または最後の2つのボタンをQMessageBox::NoButton に設定してください。
1つのボタンは「QMessageBox::Default 」と論理和(OR)で結合でき、もう1つのボタンは「QMessageBox::Escape 」と論理和(OR)で結合できます。
クリックされたボタンの識別子(QMessageBox::Ok 、QMessageBox::No など)を返します。
メッセージボックスは、application modal ダイアログボックスです。
警告: ダイアログの実行中は、parent を削除しないでください 。削除したい場合は、QMessageBox のコンストラクタのいずれかを使用して、自分でダイアログを作成する必要があります。
question()、warning()、およびcritical()も参照してください 。
[static, deprecated in 6.2] 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)
この関数はバージョン 6.2 以降、非推奨となっています。新しいコードでの使用は強く推奨しません。
代わりに、StandardButtons を引数とするオーバーロードを使用してください。
指定されたtitle およびtext を含む情報メッセージボックスと、1つ、2つ、または3つのボタンを表示します。クリックされたボタンのインデックス(0、1、または2)を返します。
button0Text は最初のボタンのテキストで、省略可能です。button0Text が指定されない場合、「OK」(翻訳済み)が使用されます。button1Text は2番目のボタンのテキストで、省略可能です。button2Text は3番目のボタンのテキストで、省略可能です。defaultButtonNumber (0、1、または2)はデフォルトボタンのインデックスです。ReturnキーまたはEnterキーを押すと、デフォルトボタンをクリックしたのと同じ動作になります。デフォルトは0(最初のボタン)です。escapeButtonNumber はエスケープボタンのインデックスです。Esc を押すと、このボタンをクリックしたのと同じ動作になります。 デフォルトは -1 です。Esc を押すと、対応するボタンをクリックしたのと同じ動作にするには、0、1、または 2 を指定してください。
メッセージボックスは、application modal ダイアログボックスです。
警告: ダイアログの実行中は、parent を削除しないでください 。削除したい場合は、QMessageBox のコンストラクタのいずれかを使用して、自分でダイアログを作成してください。
これはオーバーロードされた関数です。
question()、warning()、およびcritical()も参照してください 。
[static, deprecated in 6.2] int QMessageBox::question(QWidget *parent, const QString &title, const QString &text, int button0, int button1 = 0, int button2 = 0)
この関数はバージョン 6.2 以降、非推奨となっています。新しいコードでの使用は強く推奨しません。
代わりに、StandardButtons を受け取るオーバーロードを使用してください。
指定されたtitle およびtext を使用して、質問メッセージボックスを開きます。ダイアログには最大3つのボタンが表示されます。各ボタン(button0 、button1 、button2 )は、以下のいずれかの値に設定できます。
- QMessageBox::NoButton
- QMessageBox::Ok
- QMessageBox::Cancel
- QMessageBox::Yes
- QMessageBox::No
- QMessageBox::Abort
- QMessageBox::Retry
- QMessageBox::Ignore
- QMessageBox::YesAll
- QMessageBox::NoAll
3つのボタンすべてを表示したくない場合は、最後のボタン、または最後の2つのボタンをQMessageBox::NoButton に設定してください。
1つのボタンはQMessageBox::Default とOR演算で結合でき、もう1つのボタンはQMessageBox::Escape とOR演算で結合できます。
クリックされたボタンの識別子(QMessageBox::Yes 、QMessageBox::No など)を返します。
メッセージボックスは、application modal ダイアログボックスです。
警告: ダイアログの実行中は、parent を削除しないでください 。削除したい場合は、QMessageBox のコンストラクタのいずれかを使用して、自分でダイアログを作成する必要があります。
information()、warning()、およびcritical()も参照してください 。
[static, deprecated in 6.2] 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)
この関数はバージョン 6.2 以降、非推奨となっています。新しいコードでの使用は強く推奨しません。
代わりに、StandardButtons を受け取るオーバーロードを使用してください。
指定されたtitle およびtext を含む質問メッセージボックスと、1つ、2つ、または3つのボタンを表示します。クリックされたボタンのインデックス(0、1、または2)を返します。
button0Text は最初のボタンのテキストであり、省略可能です。button0Text が指定されていない場合、「OK」(翻訳済み)が使用されます。button1Text は2番目のボタンのテキストであり、省略可能です。button2Text は3番目のボタンのテキストであり、省略可能です。defaultButtonNumber (0、1、または2) は、デフォルトボタンのインデックスです。Return キーまたは Enter キーを押すと、デフォルトボタンをクリックしたのと同じ動作になります。デフォルトは 0(最初のボタン)です。escapeButtonNumber は、Escape ボタンのインデックスです。Escape キーを押すと、このボタンをクリックしたのと同じ動作になります。 デフォルトは -1 です。Escape キーを押すと、対応するボタンをクリックしたのと同じ動作にするには、0、1、または 2 を指定してください。
メッセージボックスは、application modal ダイアログボックスです。
警告: ダイアログの実行中は、parent を削除しないでください 。削除したい場合は、QMessageBox のコンストラクタのいずれかを使用して、ダイアログを自分で作成する必要があります。
これはオーバーロードされた関数です。
information()、warning()、およびcritical()も参照してください 。
[deprecated in 6.2] void QMessageBox::setButtonText(int button, const QString &text)
この関数はバージョン 6.2 以降、非推奨となっています。新しいコードでの使用は強く推奨しません。
メッセージボックスのボタン「button 」のテキストを「text 」に設定します。メッセージボックス内にないボタンのテキストを設定しても、何の通知もなく無視されます。
代わりに `addButton()` を使用してください。
buttonText()も参照してください 。
[static, deprecated in 6.2] QPixmap QMessageBox::standardIcon(QMessageBox::Icon icon)
この関数はバージョン 6.2 以降、非推奨となっています。新しいコードでの使用は強く推奨しません。
標準アイコンに使用されるピクマップを返します。これにより、より複雑なメッセージボックスでピクマップを使用できるようになります。icon は必要なアイコンを指定します。例:QMessageBox::Question 、QMessageBox::Information 、QMessageBox::Warning 、またはQMessageBox::Critical などです。
代わりに、QStyle::SP_MessageBoxInformation などを引数としてQStyle::standardIcon() を呼び出してください。
[static, deprecated in 6.2] int QMessageBox::warning(QWidget *parent, const QString &title, const QString &text, int button0, int button1, int button2 = 0)
この関数はバージョン 6.2 以降、非推奨となっています。新しいコードでの使用は強く推奨しません。
代わりに、StandardButtons を受け取るオーバーロードを使用してください。
指定されたtitle およびtext を使用して、警告メッセージボックスを開きます。ダイアログには最大3つのボタンを配置できます。各ボタンパラメータであるbutton0 、button1 、button2 は、以下のいずれかの値に設定できます。
- QMessageBox::NoButton
- QMessageBox::Ok
- QMessageBox::Cancel
- QMessageBox::Yes
- QMessageBox::No
- QMessageBox::Abort
- QMessageBox::Retry
- QMessageBox::Ignore
- QMessageBox::YesAll
- QMessageBox::NoAll
3つのボタンをすべて表示したくない場合は、最後のボタン、または最後の2つのボタンをQMessageBox::NoButton に設定してください。
1つのボタンはQMessageBox::Default と論理和(OR)で結合でき、もう1つのボタンはQMessageBox::Escape と論理和(OR)で結合できます。
クリックされたボタンの識別子(QMessageBox::Ok またはQMessageBox::No など)を返します。
メッセージボックスは、application modal ダイアログボックスです。
警告: ダイアログの実行中は、parent を削除しないでください 。削除したい場合は、QMessageBox のコンストラクタのいずれかを使用して、自分でダイアログを作成する必要があります。
information()、question()、およびcritical()も参照してください 。
[static, deprecated in 6.2] 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)
この関数はバージョン 6.2 以降、非推奨となっています。新しいコードでの使用は強く推奨しません。
代わりに、StandardButtons を受け取るオーバーロードを使用してください。
指定された `title ` および `text` を含む警告メッセージボックスと、1つ、2つ、または3つのボタンを表示します。クリックされたボタンの番号(0、1、または2)を返します。
button0Text は最初のボタンのテキストであり、省略可能です。button0Text が指定されていない場合は、「OK」(翻訳済み)が使用されます。button1Text は2番目のボタンのテキストであり、省略可能です。また、button2Text は3番目のボタンのテキストであり、省略可能です。defaultButtonNumber (0、1、または2)は、デフォルトボタンのインデックスです。ReturnキーまたはEnterキーを押すと、デフォルトボタンをクリックしたのと同じ動作になります。デフォルトは0(1番目のボタン)です。escapeButtonNumber はEscapeボタンのインデックスです。Escapeキーを押すと、このボタンをクリックしたのと同じ動作になります。 デフォルトは -1 です。Esc キーを押すと、対応するボタンをクリックしたのと同じ動作にするには、0、1、または 2 を指定してください。
メッセージボックスは、application modal ダイアログボックスです。
警告: ダイアログの実行中に `parent `を削除しないでください 。削除したい場合は、QMessageBox のコンストラクタのいずれかを使用して、自分でダイアログを作成する必要があります。
これはオーバーロードされた関数です。
information()、question()、およびcritical()も参照してください 。
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.