<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- qquickwebenginedialogrequests.cpp --> <title>FileDialogRequest QML Type | Qt WebEngine 5.11</title> <link rel="stylesheet" type="text/css" href="style/offline-simple.css" /> <script type="text/javascript"> document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css"); // loading style sheet breaks anchors that were jumped to before // so force jumping to anchor again setTimeout(function() { var anchor = location.hash; // need to jump to different anchor first (e.g. none) location.hash = "#"; setTimeout(function() { location.hash = anchor; }, 0); }, 0); </script> </head> <body> <div class="header" id="qtdocheader"> <div class="main"> <div class="main-rounded"> <div class="navigationbar"> <table><tr> <td ><a href="../qtdoc/index.html">Qt 5.11</a></td><td ><a href="qtwebengine-index.html">Qt WebEngine</a></td><td ><a href="qtwebengine-qmlmodule.html">QML Types</a></td><td >FileDialogRequest QML Type</td></tr></table><table class="buildversion"><tr> <td id="buildversion" width="100%" align="right">Qt 5.11.2 Reference Documentation</td> </tr></table> </div> </div> <div class="content"> <div class="line"> <div class="content mainContent"> <div class="sidebar"> <div class="toc"> <h3><a name="toc">Contents</a></h3> <ul> <li class="level1"><a href="#properties">Properties</a></li> <li class="level1"><a href="#methods">Methods</a></li> <li class="level1"><a href="#details">Detailed Description</a></li> </ul> </div> <div class="sidebar-content" id="sidebar-content"></div></div> <h1 class="title">FileDialogRequest QML Type</h1> <span class="subtitle"></span> <!-- $$$FileDialogRequest-brief --> <p>A request for letting the user choose a (new or existing) file or directory. <a href="#details">More...</a></p> <!-- @@@FileDialogRequest --> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> Import Statement:</td><td class="memItemRight bottomAlign"> import QtWebEngine 1.7</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Since:</td><td class="memItemRight bottomAlign"> QtWebEngine 1.4</td></tr></table></div><ul> <li><a href="qml-qtwebengine-filedialogrequest-members.html">List of all members, including inherited members</a></li> </ul> <a name="properties"></a> <h2 id="properties">Properties</h2> <ul> <li class="fn"><b><b><a href="qml-qtwebengine-filedialogrequest.html#accepted-prop">accepted</a></b></b> : bool</li> <li class="fn"><b><b><a href="qml-qtwebengine-filedialogrequest.html#acceptedMimeTypes-prop">acceptedMimeTypes</a></b></b> : stringlist</li> <li class="fn"><b><b><a href="qml-qtwebengine-filedialogrequest.html#defaultFileName-prop">defaultFileName</a></b></b> : string</li> <li class="fn"><b><b><a href="qml-qtwebengine-filedialogrequest.html#mode-prop">mode</a></b></b> : enumeration</li> </ul> <a name="methods"></a> <h2 id="methods">Methods</h2> <ul> <li class="fn">void <b><b><a href="qml-qtwebengine-filedialogrequest.html#dialogAccept-method">dialogAccept</a></b></b>(stringlist <i>files</i>)</li> <li class="fn">void <b><b><a href="qml-qtwebengine-filedialogrequest.html#dialogReject-method">dialogReject</a></b></b>()</li> </ul> <!-- $$$FileDialogRequest-description --> <a name="details"></a> <h2 id="details">Detailed Description</h2> <p>A <a href="qml-qtwebengine-filedialogrequest.html">FileDialogRequest</a> is passed as an argument of the <a href="qml-qtwebengine-webengineview.html#fileDialogRequested-signal">WebEngineView::fileDialogRequested</a> signal. It is generated when the file dialog is requested by the input element. See <a href="https://www.w3.org/TR/html5/forms.html#file-upload-state-(type=file)">File Upload state</a>.</p> <p>The <a href="qml-qtwebengine-filedialogrequest.html#accepted-prop">accepted</a> property of the request indicates whether the request is handled by the user code or the default dialog should be displayed. If you set the <a href="qml-qtwebengine-filedialogrequest.html#accepted-prop">accepted</a> property to <code>true</code>, make sure to call either <a href="qml-qtwebengine-filedialogrequest.html#dialogAccept-method">dialogAccept()</a> or <a href="qml-qtwebengine-filedialogrequest.html#dialogReject-method">dialogReject()</a> afterwards.</p> <p>The following code uses a custom dialog to handle the request:</p> <pre class="cpp"> WebEngineView { <span class="comment">// ...</span> onFileDialogRequested: function(request) { request<span class="operator">.</span>accepted <span class="operator">=</span> <span class="keyword">true</span>; myDialog<span class="operator">.</span>request <span class="operator">=</span> request <span class="comment">// keep the reference to the request</span> myDialog<span class="operator">.</span>accept<span class="operator">.</span>connect(request<span class="operator">.</span>dialogAccept); myDialog<span class="operator">.</span>reject<span class="operator">.</span>connect(request<span class="operator">.</span>dialogReject); myDialog<span class="operator">.</span>visible <span class="operator">=</span> <span class="keyword">true</span>; } <span class="comment">// ...</span> } </pre> <!-- @@@FileDialogRequest --> <h2>Property Documentation</h2> <!-- $$$accepted --> <div class="qmlitem"><div class="qmlproto"> <div class="table"><table class="qmlname"> <tr valign="top" class="odd" id="accepted-prop"> <td class="tblQmlPropNode"><p> <a name="accepted-prop"></a><span class="name">accepted</span> : <span class="type"><a href="../qtqml/qml-bool.html">bool</a></span></p></td></tr> </table></div> </div><div class="qmldoc"><p>Indicates whether the file picker dialog request has been handled by the signal handler.</p> <p>If the property is <code>false</code> after any signal handlers for <a href="qml-qtwebengine-webengineview.html#fileDialogRequested-signal">WebEngineView::fileDialogRequested</a> have been executed, a default file picker dialog will be shown. To prevent this, set <code>request.accepted</code> to <code>true</code>.</p> <p>The default is <code>false</code>.</p> </div></div><!-- @@@accepted --> <br/> <!-- $$$acceptedMimeTypes --> <div class="qmlitem"><div class="qmlproto"> <div class="table"><table class="qmlname"> <tr valign="top" class="odd" id="acceptedMimeTypes-prop"> <td class="tblQmlPropNode"><p> <a name="acceptedMimeTypes-prop"></a><span class="qmlreadonly">[read-only] </span><span class="name">acceptedMimeTypes</span> : <span class="type">stringlist</span></p></td></tr> </table></div> </div><div class="qmldoc"><p>A list of MIME types specified in the input element. The selection should be restricted to only these types of files.</p> </div></div><!-- @@@acceptedMimeTypes --> <br/> <!-- $$$defaultFileName --> <div class="qmlitem"><div class="qmlproto"> <div class="table"><table class="qmlname"> <tr valign="top" class="odd" id="defaultFileName-prop"> <td class="tblQmlPropNode"><p> <a name="defaultFileName-prop"></a><span class="qmlreadonly">[read-only] </span><span class="name">defaultFileName</span> : <span class="type"><a href="../qtqml/qml-string.html">string</a></span></p></td></tr> </table></div> </div><div class="qmldoc"><p>The default name of the file to be selected in the dialog.</p> </div></div><!-- @@@defaultFileName --> <br/> <!-- $$$mode --> <div class="qmlitem"><div class="qmlproto"> <div class="table"><table class="qmlname"> <tr valign="top" class="odd" id="mode-prop"> <td class="tblQmlPropNode"><p> <a name="mode-prop"></a><span class="qmlreadonly">[read-only] </span><span class="name">mode</span> : <span class="type"><a href="../qtqml/qml-enumeration.html">enumeration</a></span></p></td></tr> </table></div> </div><div class="qmldoc"><p>The mode of the file dialog.</p> <div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tbldscr">Description</th></tr> <tr><td class="topAlign"><code>FileDialogRequest.FileModeOpen</code></td><td class="topAlign">Allows users to specify a single existing file.</td></tr> <tr><td class="topAlign"><code>FileDialogRequest.FileModeOpenMultiple</code></td><td class="topAlign">Allows users to specify multiple existing files.</td></tr> <tr><td class="topAlign"><code>FileDialogRequest.FileModeUploadFolder</code></td><td class="topAlign">Allows users to specify a single existing folder for upload.</td></tr> <tr><td class="topAlign"><code>FileDialogRequest.FileModeSave</code></td><td class="topAlign">Allows users to specify a non-existing file. If an existing file is selected, the users should be informed that the file is going to be overwritten.</td></tr> </table></div> </div></div><!-- @@@mode --> <br/> <h2>Method Documentation</h2> <!-- $$$dialogAccept --> <div class="qmlitem"><div class="qmlproto"> <div class="table"><table class="qmlname"> <tr valign="top" class="odd" id="dialogAccept-method"> <td class="tblQmlFuncNode"><p> <a name="dialogAccept-method"></a><span class="type">void</span> <span class="name">dialogAccept</span>(<span class="type">stringlist</span> <i>files</i>)</p></td></tr> </table></div> </div><div class="qmldoc"><p>This function needs to be called when the user accepted the dialog with <i>files</i>.</p> </div></div><!-- @@@dialogAccept --> <br/> <!-- $$$dialogReject --> <div class="qmlitem"><div class="qmlproto"> <div class="table"><table class="qmlname"> <tr valign="top" class="odd" id="dialogReject-method"> <td class="tblQmlFuncNode"><p> <a name="dialogReject-method"></a><span class="type">void</span> <span class="name">dialogReject</span>()</p></td></tr> </table></div> </div><div class="qmldoc"><p>This function needs to be called when the user did not accepted the dialog.</p> </div></div><!-- @@@dialogReject --> <br/> </div> </div> </div> </div> </div> <div class="footer"> <p> <acronym title="Copyright">©</acronym> 2018 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners.<br/> The documentation provided herein is licensed under the terms of the <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation License version 1.3</a> as published by the Free Software Foundation.<br/> 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. </p> </div> </body> </html>