Obsolete Members for WebEngineView

The following members of QML type WebEngineView 已过时。 提供它们是为使旧源代码能继续工作。强烈建议不要在新代码中使用它们。

信号

信号文档编制

activeFocusOnPressChanged ( bool activeFocusOnPress )

This signal is emitted when the value of activeFocusOnPress changes. It specifies whether the view should gain active focus when pressed.

该信号在 QtWebEngine 1.2 引入。

另请参阅 activeFocusOnPress and setActiveFocusOnPress() .

audioMutedChanged ( bool muted )

This signal is emitted when the value of muted changes. The value is specified using the audioMuted 特性。

注意: Not to be confused with a specific HTML5 audio / video element being muted.

该信号在 QtWebEngine 1.3 引入。

另请参阅 audioMuted and recentlyAudibleChanged .

authenticationDialogRequested ( AuthenticationDialogRequest request )

This signal is emitted when an authentication dialog is requested.

The request can be handled by using the methods of the AuthenticationDialogRequest 类型。

注意: Signal handlers need to call request.accepted = true to prevent a default dialog from showing up. Make sure to call either AuthenticationDialogRequest::dialogAccept() or AuthenticationDialogRequest::dialogReject() afterwards.

该信号在 QtWebEngine 1.4 引入。

backgroundColorChanged ()

This signal is emitted when the web engine view background color changes.

该信号在 QtWebEngine 1.2 引入。

certificateError ( WebEngineCertificateError error )

This signal is emitted when an invalid certificate error, error , is raised while loading a given request.

The certificate error can be handled by using the methods of the WebEngineCertificateError 类型。

该信号在 QtWebEngine 1.1 引入。

colorDialogRequested ( ColorDialogRequest request )

This signal is emitted when a color picker dialog is requested.

The request can be handled by using the methods of the ColorDialogRequest 类型。

注意: Signal handlers need to call request.accepted = true to prevent a default dialog from showing up. Make sure to call either ColorDialogRequest::dialogAccept() or ColorDialogRequest::dialogReject() afterwards.

该信号在 QtWebEngine 1.4 引入。

contextMenuRequested ( ContextMenuRequest request )

This signal is emitted when a context menu is requested.

The request can be handled by using the properties of the ContextMenuRequest 类型。

注意: Signal handlers need to call request.accepted = true to prevent a default context menu from showing up.

该信号在 QtWebEngine 1.4 引入。

featurePermissionRequested ( url securityOrigin , Feature feature )

此信号被发射当网站被标识通过 securityOrigin 请求使用资源 (或设备) 的标识通过 feature .

该信号在 QtWebEngine 1.1 引入。

另请参阅 grantFeaturePermission() .

fileDialogRequested ( FileDialogRequest request )

This signal is emitted when a file picker dialog is requested.

The request can be handled by using the methods of the FileDialogRequest 类型。

注意: Signal handlers need to call request.accepted = true to prevent a default dialog from showing up. Make sure to call either FileDialogRequest::dialogAccept() or FileDialogRequest::dialogReject() afterwards.

该信号在 QtWebEngine 1.4 引入。

fullScreenRequested ( FullScreenRequest request )

This signal is emitted when the web page issues the request for fullscreen mode through the JavaScript API.

该信号在 QtWebEngine 1.1 引入。

另请参阅 isFullScreen .

geometryChangeRequested ( rect geometry , rect frameGeometry )

此信号被发射每当文档希望把页面位置和大小更改为 frameGeometry 。这会发生,例如透过 JavaScript。

While frameGeometry includes, geometry excludes the size of frame margins.

注意: Geometry related properties of QML Window expect a size excluding the window decoration. You have to use geometry 以正确处理此信号。

onGeometryChangeRequested: {
    window.x = geometry.x
    window.y = geometry.y
    window.width = geometry.width
    window.height = geometry.height
}
																

该信号在 QtWebEngine 1.7 引入。

javaScriptConsoleMessage ( JavaScriptConsoleMessageLevel level , string message , int lineNumber , string sourceID )

This signal is emitted when a JavaScript program tries to print a message to the web browser's console.

For example, in case of evaluation errors the source URL may be provided in sourceID as well as the lineNumber .

level indicates the severity of the event that triggered the message, that is, whether it was triggered by an error or a less severe event.

If no handler is specified, the view will log the messages into a js 日志类别 .

另请参阅 控制台日志 .

javaScriptDialogRequested ( JavaScriptDialogRequest request )

This signal is emitted when a JavaScript dialog is requested.

The request can be handled by using the methods of the JavaScriptDialogRequest 类型。

注意: Signal handlers need to call request.accepted = true to prevent a default dialog from showing up. Make sure to call either JavaScriptDialogRequest::dialogAccept() or JavaScriptDialogRequest::dialogReject() afterwards.

该信号在 QtWebEngine 1.4 引入。

linkHovered ( url hoveredUrl )

Within a mouse-driven interface, this signal is emitted when a mouse pointer passes over a link, corresponding to the mouseover DOM event. This event may also occur in touch interfaces for mouseover events that are not cancelled with preventDefault() . hoveredUrl provides the link's location.

loadingChanged ( WebEngineLoadRequest loadRequest )

This signal is emitted when a page load begins, ends, or fails.

When handling the signal with onLoadingChanged , various read-only parameters are available on the WebEngineLoadRequest 指定通过 loadRequest .

另请参阅 loading , LoadStatus ,和 ErrorDomain .

This signal is emitted when the navigation request request is issued.

newViewRequested ( WebEngineNewViewRequest request )

此信号发射当 request is issued to load a page in a separate web engine view. This can either be because the current page requested it explicitly through a JavaScript call to window.open , or because the user clicked on a link while holding Shift, Ctrl, or a built-in combination that triggers the page to open in a new window.

If this signal is not handled, the requested load will fail.

An example implementation:

QtObject {
    id: windowParent
    // Create the initial browsing windows and open the startup page.
    Component.onCompleted: {
        var firstWindow = windowComponent.createObject(windowParent);
        firstWindow.webView.loadHtml('<input type="button" value="Click!" onclick="window.open("http://qt.io")">');
    }
    property Component windowComponent: Window {
        // Destroy on close to release the Window's QML resources.
        // Because it was created with a parent, it won't be garbage-collected.
        onClosing: destroy()
        visible: true
        property WebEngineView webView: webView_
        WebEngineView {
            id: webView_
            anchors.fill: parent
            // Handle the signal. Dynamically create the window and
            // use its WebEngineView as the destination of our request.
            onNewViewRequested: function(request) {
                var newWindow = windowComponent.createObject(windowParent);
                request.openIn(newWindow.webView);
            }
        }
    }
}
																						

该信号在 QtWebEngine 1.1 引入。

另请参阅 NewViewDestination and WebEngine Quick 纳米浏览器 .

pdfPrintingFinished ( string filePath , bool success )

此信号被发射,当把网页打印成 PDF 文件完成时。 filePath 将包含请求创建的文件路径,且 success 将是 true 若成功创建文件且 false 否则。

该信号在 QtWebEngine 1.5 引入。

另请参阅 printToPdf() .

printRequest ()

此信号被发射当 JavaScript window.print() 方法被调用。通常,信号处理程序可以简单调用 printToPdf() .

该信号在 QtWebEngine 1.8 引入。

另请参阅 printToPdf .

quotaRequested ( QuotaRequest request )

This signal is emitted when the web page issues a request for a larger persistent storage than the application's current allocation in File System API. The default quota is 0 bytes.

该信号在 QtWebEngine 1.7 引入。

另请参阅 QuotaRequest .

recentlyAudibleChanged ( bool recentlyAudible )

This signal is emitted when the page's audible state, specified by recentlyAudible , is changed, due to audio being played or stopped.

注意: The signal is also emitted when the audioMuted property changes. Also if the audio is paused, this signal is emitted with an approximate 2 秒延迟 ,从音频被暂停的那一刻起。

This signal is also emitted for Flash plugin audio.

If a web page contains two videos that are started in sequence, this signal gets emitted only once, for the first video to generate sound. After both videos are stopped, the signal is emitted upon the last sound generated. This means that the signal is emitted both when any kind of sound is generated and when everything is completely silent within a web page, regardless of the number of audio streams.

Spurious signal emissions might also happen. For example, when sound is stopped, this signal gets emitted first with a value of true , and then with a value of false . Further, when audio starts playing, the signal is emitted twice with a value of true .

该信号在 QtWebEngine 1.3 引入。

另请参阅 recentlyAudible .

registerProtocolHandlerRequested ( RegisterProtocolHandlerRequest request )

This signal is emitted when the web page tries to register a custom protocol by issuing a registerProtocolHandler request .

该信号在 QtWebEngine 1.7 引入。

另请参阅 RegisterProtocolHandlerRequest .

renderProcessTerminated ( RenderProcessTerminationStatus terminationStatus , int exitCode )

此信号被发射当渲染进程采用非零退出状态被终止时。 terminationStatus 是进程的终止状态,且 exitCode 是进程终止的状态码。

该信号在 QtWebEngine 1.2 引入。

另请参阅 RenderProcessTerminationStatus .

wasRecentlyAudibleChanged ( bool wasRecentlyAudible )

This signal is emitted when the page's audible state, specified by wasRecentlyAudible , is changed, due to audio being played or stopped.

注意: The signal is also emitted when calling the setAudioMuted method. Also if the audio is paused, this signal is emitted with an approximate 2 second delay ,从音频被暂停的那一刻起。

该信号在 QtWebEngine 1.3 引入。

windowCloseRequested ()

此信号被发射每当页面请求关闭 Web 浏览器窗口时,例如透过 JavaScript window.close() 调用。

该信号在 QtWebEngine 1.2 引入。