如何在QtWebEngine QML应用程序中设置用户代理

如何在QtWebEngine QML应用程序中设置用户代理,qt,qml,qt5,user-agent,qtwebengine,Qt,Qml,Qt5,User Agent,Qtwebengine,注意:我可以在QtWebKit QML上使用。这里我对使用QtWebEngine感兴趣 我的简单测试应用程序 import QtQuick 2.1 import QtQuick.Controls 1.1 import QtWebEngine 1.0 ApplicationWindow { width: 800 height: 600 color: "lightgray" visible: true WebEngineView { id:

注意:我可以在QtWebKit QML上使用。这里我对使用QtWebEngine感兴趣

我的简单测试应用程序

import QtQuick 2.1
import QtQuick.Controls 1.1
import QtWebEngine 1.0

ApplicationWindow {
    width: 800
    height: 600
    color: "lightgray"
    visible: true
    WebEngineView {
        id: webview
        url: "http://stackexchange.com/"
        anchors.fill: parent
    }
}

如何通过不同的考试?

我也对使用QtWebEngine感兴趣。我可以建议您使用QtWebEngine开发人员


正如您在5.5的Todo中所看到的,这是并且可以在5.5中完成。

从Qt5.5开始,您可以设置属性。

//导入QtWebEngine 1.4

WebEngineView {
    id: webview
    url: "http://stackexchange.com/"
    anchors.fill: parent
    profile:  WebEngineProfile{
        httpUserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1"
    }
}

真是好极了。谢谢你。