Warning, /maui/mauikit/src/controls.6/InputDialog.qml is written in an unsupported language. File is not indexed.
0001 import QtQuick 0002 import QtQuick.Controls 0003 import QtQuick.Layouts 0004 0005 import org.mauikit.controls 1.3 as Maui 0006 0007 /** 0008 * @inherit InfoDialog 0009 * @brief An InfoDialog with a text entry field. 0010 * 0011 * This control inherits from MauiKit InfoDialog, to checkout its inherited properties refer to docs. 0012 * 0013 * This dialog can have information labels and icon/image, any number of children, and more. Refer to the structure of the Info Dialog. 0014 * @see InfoDialog::structure Structure 0015 * 0016 * @image html Misc/inputdialog.png 0017 * 0018 * @code 0019 * Maui.InputDialog 0020 * { 0021 * id: _dialog 0022 * title: "Hello" 0023 * message: "An input dialog that request some information ot be entered." 0024 * 0025 * template.iconSource: "dialog-question" 0026 * textEntry.placeholderText: "Give me a name." 0027 * 0028 * onRejected: close() 0029 * onFinished: (text) => console.log(text) 0030 * } 0031 * @endcode 0032 * 0033 * <a href="https://invent.kde.org/maui/mauikit/-/blob/qt6-2/examples/InputDialog.qml">You can find a more complete example at this link.</a> 0034 */ 0035 Maui.InfoDialog 0036 { 0037 id: control 0038 0039 /** 0040 * @brief An alias to acces the entry field handled by a QQC2 TextField control. 0041 * @note See Qt documentation on TextField for further information on its properties. 0042 * @property TextField InputDialog::textEntry 0043 */ 0044 property alias textEntry: _textEntry 0045 0046 /** 0047 * @brief Emitted when the dialog has been accepted. 0048 * This will depend on keeping the `standardButtons` as they are, or setting one that triggers the accepted role. 0049 * @note For more information on the standard buttons ad their roles, checkout Qt Dialog docs. 0050 * @param The text entered in the text entry field. 0051 */ 0052 signal finished(string text) 0053 0054 standardButtons: Dialog.Ok | Dialog.Cancel 0055 0056 TextField 0057 { 0058 id: _textEntry 0059 Layout.fillWidth: true 0060 onAccepted: control.standardButton(Dialog.Ok).forceActiveFocus() 0061 } 0062 0063 onAccepted: 0064 { 0065 finished(textEntry.text) 0066 textEntry.clear() 0067 close() 0068 } 0069 0070 onRejected: 0071 { 0072 textEntry.clear() 0073 control.close() 0074 } 0075 0076 onOpened: 0077 { 0078 textEntry.forceActiveFocus() 0079 textEntry.selectAll() 0080 } 0081 }