1. MessageDialog Sample
1.1. 目的
Qt5.15のMessageDialogがQt6にてプロパティが変更になったために、Qt5.15のMessageDialogと同じ動作をするMessageDialogコンポーネントを提供する。
1.2. 参考資料
- MessageDialog QML Type | Qt Quick Dialogs 5.15
- MessageDialog QML Type | Qt Quick Dialogs 6.8
- Window QML Type | Qt Quick 6.8
- DialogButtonBox QML Type | Qt Quick Controls 6.8
1.3. 作成結果
Qt5.15 | Qt6.8.0 |
---|---|
![]() |
![]() |
1.4. 仕様
1.4.1. MessageDialog
項目 | 値 |
---|---|
Import | Qt5Compat.Dialogs 1.0 |
Inherits | Window |
1.4.1.1. プロパティ
型 | プロパティ名 | デフォルト値 | 説明 |
---|---|---|---|
string | text | 表示されるテキスト | |
string | detailedText | 詳細領域に表示されるテキスト | |
string | informativeText | メッセージの詳細な説明 | |
real | topPadding | 0 | トップパディング |
real | bottomPadding | 0 | ボトムパディング |
real | leftPadding | 20 | レフトパディング |
real | rightPadding | 20 | ライトパディング |
bool | showDetailedText | false | detailedTextの表示状態 |
int | standardButtons | DialogButtonBox.Ok | 標準ボタンの組み合わせ |
int(enum) | icon | MessageDialog.StandardIcon.NoIcon | メッセージダイアログのアイコン- MessageDialog.StandardIcon.NoIcon- MessageDialog.StandardIcon.Question- MessageDialog.StandardIcon.Information- MessageDialog.StandardIcon.Warning- MessageDialog.StandardIcon.Critical |
reaonly string | standardIconSource | メッセージダイアログのアイコンのソース |
1.4.1.2. シグナル
シグナル名 | 引数 | 説明 |
---|---|---|
accepted | AcceptRole、YesRoleの標準ボタンが押下された際に呼ばれる | |
apply | ApplyRoleの標準ボタンが押下された際に呼ばれる | |
discard | DiscardRoleの標準ボタンが押下された際に呼ばれる | |
help | HelpRoleの標準ボタンが押下された際に呼ばれる | |
rejected | RejectRole、NoRoleの標準ボタンが押下された際に呼ばれる | |
reset | ResetRoleの標準ボタンが押下された際に呼ばれる | |
buttonClicked | button:AbstractButton | 標準ボタンが押下された際に呼ばれる |
1.4.1.3. メソッド
戻り値 | メソッド名 | 引数 | 説明 |
---|---|---|---|
void | open | ダイアログを表示する | |
void | finish | ダイアログを閉じ、showDetailedTextをfalseに設定する |