2

QML (main.qml) を使用してローカル HTML ファイル index.html をロードしようとして いますurl: "file:///../../htmlfiles/index.html" が、機能しません。

助けていただけますか?

4

5 に答える 5

5

qApp->applicationDirPath()私はc ++からQMLに渡し、問題を修正するためにsetContextProperty()使用しました。url: "file:///" + applicationDirPath + "/htmlfiles/index.html"

于 2011-05-26T15:17:12.743 に答える
3
WebView {
        url: Qt.resolvedUrl( "html/index.html" )
        x: 0
        y: 0
        smooth: false
        anchors {
            top: window.top
            bottom: window.bottom
            left: window.left
            right: window.right
        }
    }

これは私のために働く!

于 2012-06-13T20:12:32.937 に答える
2

なしで試してくださいfile:///

WebView {
    url: "../../htmlfiles/index.html"
    // [...]
}
于 2011-05-25T08:08:21.447 に答える
1

それを行うより簡単な方法があります:

WebView {
        id: translationsList
        anchors.fill: parent
        url: "qrc:/about.html"
        }
于 2011-09-01T19:40:05.113 に答える
0

試してください:filename = "/ etc / issue"; url = Qt.resolvedUrl(ファイル名);

于 2012-02-10T02:53:20.603 に答える