AuthenticationDialogRequest QML Type
请求提供代理或 HTTP 服务器所需的身份验证凭据。更多
Import Statement: | import QtWebEngine |
Since: | QtWebEngine 1.4 |
属性
方法
- void dialogAccept(string username, string password)
- void dialogReject()
详细说明
AuthenticationDialogRequest 作为WebEngineView::authenticationDialogRequested 信号的参数传递。当需要进行基本 HTTP 或代理身份验证时,就会生成该请求。认证类型可通过type 属性进行检查。
请求的accepted 属性表示该请求是由用户代码处理还是显示默认对话框。如果将accepted 属性设置为true
,请确保随后调用dialogAccept() 或dialogReject() 。
以下代码使用自定义对话框处理请求:
WebEngineView { // ... onAuthenticationDialogRequested: function(request) { request.accepted = true; myDialog.request = request // keep the reference to the request myDialog.accept.connect(request.dialogAccept); myDialog.reject.connect(request.dialogReject); myDialog.visible = true; } // ... }
属性文档
accepted : bool |
表示身份验证对话框请求是否已被信号处理程序接受。
如果在执行WebEngineView::authenticationDialogRequested 的任何信号处理程序后,属性为false
,则将显示默认身份验证对话框。为防止出现这种情况,请将request.accepted
设置为true
。
默认值为false
。
type : enumeration |
身份验证请求类型。
常量 | 描述 |
---|---|
WebEngineAuthenticationDialogRequest.AuthenticationTypeHTTP | HTTP 身份验证。 |
WebEngineAuthenticationDialogRequest.AuthenticationTypeProxy | 代理身份验证。 |
方法文档
void dialogReject() |
此函数通知引擎用户拒绝对话,身份验证将不会继续。
© 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.