使用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。
// don't know exactly what is the problem but you can try this
viewer.webView()->setAcceptHoverEvents(true);
我不知道解决方案,但是我知道问题是什么,问题是向导不要把正确的路径送达index.html,所以我确实在/上拉了索引数据/local/tmp/只是为了测试应用
viewer.loadfile(qlatin1string("/data/local/local/tmp/index.html"));
finaly这是解决方案,它完成了!!!
viewer.loadurl(qurl("资产:/html/index.html"));