Dialog QML Type
The base class of native dialogs. More...
Import Statement: | import QtQuick.Dialogs |
Since: | Qt 6.2 |
Inherits: | |
Inherited By: | ColorDialog, FileDialog, FolderDialog, FontDialog, and MessageDialog |
Properties
- data : list<QtObject>
- flags : Qt::WindowFlags
- modality : Qt::WindowModality
- parentWindow : Window
- popupType : enumeration
(since 6.10)
- result : int
- title : string
- visible : bool
Signals
Methods
Detailed Description
The Dialog type provides common QML API for native platform dialogs. For the non-native dialog, see Dialog.
To show a native dialog, construct an instance of one of the concrete Dialog implementations, set the desired properties, and call open(). Dialog emits accepted() or rejected() when the user is done with the dialog.
Note: This is an internal type that cannot be created in QML.
Property Documentation
data : list<QtObject> [default]
This default property holds the list of all objects declared as children of the dialog.
flags : Qt::WindowFlags
This property holds the window flags of the dialog. The default value is Qt.Dialog
.
modality : Qt::WindowModality
This property holds the modality of the dialog. The default value is Qt.WindowModal
.
Available values:
Constant | Description |
---|---|
Qt.NonModal | The dialog is not modal and does not block input to other windows. |
Qt.WindowModal | The dialog is modal to a single window hierarchy and blocks input to its parent window, all grandparent windows, and all siblings of its parent and grandparent windows. |
Qt.ApplicationModal | The dialog is modal to the application and blocks input to all windows. |
parentWindow : Window
This property holds the parent window of the dialog.
Unless explicitly set, the window is automatically resolved by iterating the QML parent objects until a Window or an Item that has a window is found.
popupType : enumeration [since 6.10]
This property can be used to change the popupType of the non-native quick dialog.
The available values are:
Constant | Description |
---|---|
Popup.Item | The dialog will appear as an item in the window of the nearest parent item. |
Popup.Window | The dialog will appear inside its own window. |
Popup.Native | This value is not supported. Popup.Window will be used instead. |
Note: This property has no effect when using a native dialog.
This property was introduced in Qt 6.10.
result : int
This property holds the result code.
Standard result codes:
Constant | Value |
---|---|
Dialog.Accepted | |
Dialog.Rejected |
Note: MessageDialog sets the result to the value of the clicked standard button instead of using the standard result codes.
title : string
This property holds the title of the dialog.
visible : bool
This property holds the visibility of the dialog. The default value is false
.
Signal Documentation
void accepted()
This signal is emitted when the dialog has been accepted either interactively or by calling accept().
Note: The corresponding handler is onAccepted
.
See also rejected().
void rejected()
This signal is emitted when the dialog has been rejected either interactively or by calling reject().
This signal is also emitted when closing the dialog with close().
Note: The corresponding handler is onRejected
.
See also accepted().
Method Documentation
void accept()
Closes the dialog and emits the accepted() signal.
See also reject().
void close()
Closes the dialog and emits either the accepted() or rejected() signal.
void done(int result)
Closes the dialog and sets the result.
See also accept(), reject(), and result.
void open()
Opens the dialog.
void reject()
Closes the dialog and emits the rejected() signal.
See also accept().
© 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.