2

QtCreatorアプリケーションウィザードを使用して、Html5アプリケーションテンプレートを使用してプロジェクトを作成しました。

ページを表示することになっていindex.htmlます。Chromeにロードすると、ページは正常に機能します。私のQtプログラムは正しくレンダリングしますが、ボタン、リンク、またはスクロールバーでクリックが機能しません。

私のコードは、まさにウィザードが生成したものです。

int main(int argc, char *argv[]) {

    QApplication app(argc, argv);

    Html5ApplicationViewer viewer;
    viewer.setOrientation(Html5ApplicationViewer::ScreenOrientationAuto);

    viewer.showExpanded(); //Load the HTML Page
    viewer.loadFile(QLatin1String("html/index.html"));

    return app.exec();
}

誰かがこの問題に直面しましたか?私はQt4.7.2を持っています。

4

3 に答える 3

4
// don't know exactly what is the problem but you can try this    
viewer.webView()->setAcceptHoverEvents(true);
于 2013-04-22T00:11:13.167 に答える
0

最後に、これが解決策であり、完了です!!!

Viewer.loadUrl(QUrl( "assets:/html/index.html"));

于 2012-11-12T03:14:04.723 に答える
0

解決策はわかりませんが、何が問題なのかはわかります。問題は、ウィザードが index.html への正しいパスを設定しないことです。そのため、アプリをテストするためだけに /data/local/tmp/ のインデックスをプルしました。

viewer.loadFile(QLatin1String("/data/local/tmp/index.html"));

于 2012-11-10T04:43:06.533 に答える