Dialog QML Type
標準的なボタンとタイトルを持つポップアップダイアログ。もっと見る...
Import Statement: | import QtQuick.Controls |
Inherits: |
プロパティ
- footer : Item
- header : Item
- implicitFooterHeight : real
(since QtQuick.Controls 2.5 (Qt 5.12))
- implicitFooterWidth : real
(since QtQuick.Controls 2.5 (Qt 5.12))
- implicitHeaderHeight : real
(since QtQuick.Controls 2.5 (Qt 5.12))
- implicitHeaderWidth : real
(since QtQuick.Controls 2.5 (Qt 5.12))
- result : int
(since QtQuick.Controls 2.3 (Qt 5.10))
- standardButtons : enumeration
- title : string
信号
- accepted()
- applied()
(since QtQuick.Controls 2.3 (Qt 5.10))
- discarded()
(since QtQuick.Controls 2.3 (Qt 5.10))
- helpRequested()
(since QtQuick.Controls 2.3 (Qt 5.10))
- rejected()
- reset()
(since QtQuick.Controls 2.3 (Qt 5.10))
方法
- void accept()
- void done(int result)
(since QtQuick.Controls 2.3 (Qt 5.10))
- void reject()
- AbstractButton standardButton(StandardButton button)
(since QtQuick.Controls 2.3 (Qt 5.10))
詳しい説明
ダイアログは、主に短期的なタスクやユーザーとの短いコミュニケーションに使用されるポップアップです。ApplicationWindow やPage と同様に、ダイアログは3つのセクションで構成されています:header contentItem とfooter の3つのセクションで構成されています。
padding プロパティは contentItem にのみ影響します。ヘッダー、contentItem、フッターの間のスペースにはspacing プロパティを使います。
デフォルトでは、ダイアログはfocus を持ちます。
ダイアログのタイトルとボタン
Dialogのtitle は、デフォルトではダイアログheader として割り当てられたスタイル固有のタイトルバーによって表示されます。
ダイアログの標準ボタンは、デフォルトでダイアログfooter として割り当てられているDialogButtonBox によって管理されます。ダイアログのstandardButtons プロパティは、ボタンボックスのそれぞれのプロパティに転送されます。さらに、ボタンボックスのaccepted ()とrejected ()のシグナルはDialogのそれぞれのシグナルに接続されます。
Dialog { id: dialog title: "Title" standardButtons: Dialog.Ok | Dialog.Cancel onAccepted: console.log("Ok clicked") onRejected: console.log("Cancel clicked") }
モーダルダイアログ
modal ダイアログは、ダイアログの下にある他のコンテンツへの入力をブロックします。モーダルダイアログが開かれると、同じウィンドウ内の他のコンテンツにアクセスする前に、ユーザーはダイアログとの対話を終了し、ダイアログを閉じなければなりません。
Dialog { id: dialog modal: true standardButtons: Dialog.Ok }
モードレスダイアログ
モードレスダイアログは、ダイアログの周りの他のコンテンツから独立して動作するダイアログです。モードレスダイアログが開かれると、ユーザーはダイアログと同じウィンドウ内の他のコンテンツの両方を操作することができます。
Dialog { id: dialog modal: false standardButtons: Dialog.Ok }
DialogButtonBox とポップアップコントロールも参照してください 。
プロパティ Documentation
footer : Item |
このプロパティは、ダイアログフッター項目を保持します。フッター項目は一番下に配置され、ダイアログの幅にリサイズされる。デフォルト値はnull
です。
注 :DialogButtonBox をダイアログフッターとして割り当てると、自動的にそのaccepted() とrejected() のシグナルが Dialog のそれぞれのシグナルに接続されます。
注: DialogButtonBox 、ToolBar 、TabBar をダイアログフッターとして割り当てると、それぞれのDialogButtonBox::position 、ToolBar::position 、TabBar::position プロパティが自動的にFooter
に設定されます。
headerも参照してください 。
header : Item |
このプロパティはダイアログヘッダー項目を保持します。ヘッダー項目は上部に配置され、ダイアログの幅にリサイズされます。デフォルト値はnull
です。
注 :DialogButtonBox をダイアログヘッダーとして割り当てると、自動的にそのaccepted() とrejected() のシグナルが Dialog のそれぞれのシグナルに接続されます。
注: DialogButtonBox 、ToolBar 、TabBar をダイアログヘッダーとして割り当てると、自動的にそれぞれのDialogButtonBox::position 、ToolBar::position 、TabBar::position プロパティがHeader
に設定されます。
footerも参照してください 。
implicitFooterHeight : real |
このプロパティは、暗黙のフッタの高さを保持します。
値はfooter && footer.visible ? footer.implicitHeight : 0
に等しくなります。
このプロパティは QtQuick.Controls 2.5 (Qt 5.12) で導入されました。
implicitFooterWidth およびimplicitHeaderHeightも参照してください 。
implicitFooterWidth : real |
このプロパティは、暗黙のフッター幅を保持します。
値はfooter && footer.visible ? footer.implicitWidth : 0
と同じです。
このプロパティは QtQuick.Controls 2.5 (Qt 5.12) で導入されました。
implicitFooterHeight およびimplicitHeaderWidthも参照してください 。
implicitHeaderHeight : real |
このプロパティは、暗黙のヘッダーの高さを保持します。
値はheader && header.visible ? header.implicitHeight : 0
と同じです。
このプロパティは QtQuick.Controls 2.5 (Qt 5.12) で導入されました。
implicitHeaderWidth およびimplicitFooterHeightも参照してください 。
implicitHeaderWidth : real |
このプロパティは、暗黙のヘッダー幅を保持します。
値はheader && header.visible ? header.implicitWidth : 0
と同じです。
このプロパティは QtQuick.Controls 2.5 (Qt 5.12) で導入されました。
implicitHeaderHeight およびimplicitFooterWidthも参照してください 。
result : int |
standardButtons : enumeration |
このプロパティは、ダイアログで使用される標準ボタンの組み合わせを保持します。
Dialog { id: dialog title: "Title" standardButtons: Dialog.Ok | Dialog.Cancel onAccepted: console.log("Ok clicked") onRejected: console.log("Cancel clicked") }
ボタンは、ユーザーのプラットフォームに適した順序で配置されます。
可能なフラグ
定数 | 説明 |
---|---|
Dialog.Ok | AcceptRole で定義された "OK "ボタン。 |
Dialog.Open | AcceptRole で定義された「開く」ボタン。 |
Dialog.Save | AcceptRole で定義された「保存」ボタン。 |
Dialog.Cancel | RejectRole で定義された「キャンセル」ボタン。 |
Dialog.Close | RejectRole で定義された「閉じる」ボタン。 |
Dialog.Discard | プラットフォームによって異なるが、DestructiveRole で定義された「破棄」または「保存しない」ボタン。 |
Dialog.Apply | ApplyRole で定義された「適用」ボタン。 |
Dialog.Reset | ResetRole で定義された「リセット」ボタン。 |
Dialog.RestoreDefaults | ResetRole で定義されている「デフォルトに戻す」ボタン。 |
Dialog.Help | HelpRole で定義された「ヘルプ」ボタン。 |
Dialog.SaveAll | AcceptRole で定義された「すべて保存」ボタン。 |
Dialog.Yes | YesRole で定義された「はい」ボタン。 |
Dialog.YesToAll | YesRole で定義された「Yes to All」ボタン。 |
Dialog.No | NoRole で定義された「いいえ」ボタン。 |
Dialog.NoToAll | NoRole で定義された「No to All」ボタン。 |
Dialog.Abort | RejectRole で定義された「中止」ボタン。 |
Dialog.Retry | AcceptRole で定義される「再試行」ボタン。 |
Dialog.Ignore | AcceptRole で定義された「無視」ボタン。 |
Dialog.NoButton | 無効ボタン。 |
DialogButtonBoxも参照してください 。
title : string |
シグナル ドキュメント
accepted() |
|
|
|
rejected() |
|
メソッドの説明
|
|
指定された標準のbutton を返し、存在しない場合はnull
を返します。
このメソッドは QtQuick.Controls 2.3 (Qt 5.10) で導入されました。
standardButtonsも参照してください 。
© 2025 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.