鼠标活动在QT Webkit上的Html5ApplicationViewer中无效

时间:2012-10-18 05:55:24

标签: html5 qt qt-creator

使用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();
}

有人遇到过这个问题吗?我有Qt 4.7.2。

3 个答案:

答案 0 :(得分:4)

// don't know exactly what is the problem but you can try this    
viewer.webView()->setAcceptHoverEvents(true);

答案 1 :(得分:0)

我不知道解决方案,但我知道问题是什么,问题是向导没有把正确的路径放到index.html,所以我把索引拉到/ data / local / tmp /只是为了测试应用

viewer.loadFile(QLatin1String( “/数据/本地的/ tmp / index.html中”));

答案 2 :(得分:0)

最后这是解决方案及其完成!!!

viewer.loadUrl(QUrl( “资产:/html/index.html”));