<?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>ColorDialogRequest QML Type | Qt WebEngine 5.12.6</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 >Qt 5.12</td><td ><a href="qtwebengine-index.html">Qt WebEngine</a></td><td ><a href="qtwebengine-qmlmodule.html">QML Types</a></td><td >ColorDialogRequest QML Type</td></tr></table><table class="buildversion"><tr> <td id="buildversion" width="100%" align="right"><a href="qtwebengine-index.html">Qt 5.12.6 Reference Documentation</a></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">ColorDialogRequest QML Type</h1> <span class="subtitle"></span> <!-- $$$ColorDialogRequest-brief --> <p>A request for selecting a color by the user. <a href="#details">More...</a></p> <!-- @@@ColorDialogRequest --> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> Import Statement:</td><td class="memItemRight bottomAlign"> import QtWebEngine 1.8</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-colordialogrequest-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-colordialogrequest.html#accepted-prop">accepted</a></b></b> : bool</li> <li class="fn"><b><b><a href="qml-qtwebengine-colordialogrequest.html#color-prop">color</a></b></b> : color</li> </ul> <a name="methods"></a> <h2 id="methods">Methods</h2> <ul> <li class="fn">void <b><b><a href="qml-qtwebengine-colordialogrequest.html#dialogAccept-method">dialogAccept</a></b></b>(color <i>color</i>)</li> <li class="fn">void <b><b><a href="qml-qtwebengine-colordialogrequest.html#dialogReject-method">dialogReject</a></b></b>()</li> </ul> <!-- $$$ColorDialogRequest-description --> <a name="details"></a> <h2 id="details">Detailed Description</h2> <p>A <a href="qml-qtwebengine-colordialogrequest.html">ColorDialogRequest</a> is passed as an argument of the <a href="qml-qtwebengine-webengineview.html#colorDialogRequested-signal">WebEngineView::colorDialogRequested</a> signal. It is generated when a color picker dialog is requested. See <a href="https://www.w3.org/TR/html5/forms.html#color-state-(type=color)">HTML5 Color State</a>.</p> <p>The <a href="qml-qtwebengine-colordialogrequest.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-colordialogrequest.html#accepted-prop">accepted</a> property to <code>true</code>, make sure to call either <a href="qml-qtwebengine-colordialogrequest.html#dialogAccept-method">dialogAccept()</a> or <a href="qml-qtwebengine-colordialogrequest.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> onColorDialogRequested: 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> <!-- @@@ColorDialogRequest --> <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">bool</span></p></td></tr> </table></div> </div><div class="qmldoc"><p>Indicates whether the color picker dialog request has been accepted by the signal handler.</p> <p>If the property is <code>false</code> after any signal handlers for <a href="qml-qtwebengine-webengineview.html#colorDialogRequested-signal">WebEngineView::colorDialogRequested</a> have been executed, a default color 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/> <!-- $$$color --> <div class="qmlitem"><div class="qmlproto"> <div class="table"><table class="qmlname"> <tr valign="top" class="odd" id="color-prop"> <td class="tblQmlPropNode"><p> <a name="color-prop"></a><span class="qmlreadonly">[read-only] </span><span class="name">color</span> : <span class="type">color</span></p></td></tr> </table></div> </div><div class="qmldoc"><p>The default color to be selected in the dialog.</p> </div></div><!-- @@@color --> <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">color</span> <i>color</i>)</p></td></tr> </table></div> </div><div class="qmldoc"><p>This function notifies the engine that the user accepted the dialog, providing the <i>color</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 notifies the engine that the user rejected the dialog.</p> </div></div><!-- @@@dialogReject --> <br/> </div> </div> </div> </div> </div> <div class="footer"> <p> <acronym title="Copyright">©</acronym> 2019 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>