如何让Qt支持HTML 5数据库?
我正在使用 Qt 4.7.1 并在我的应用程序中嵌入了 webview。但在尝试访问 http://webkit.org/demos/sticky-notes/ 时出现以下错误 为了测试 HTML 5 数据库功能
Failed to open the database on disk. This is probably because the version
was bad or there is not enough space left in this domain's quota
,我使用以下命令编译了静态 Qt 库:
configure --prefix=/usr/local/qt-static-release-db --accessibility --multimedia
--audio-backend --svg --webkit --javascript-jit --script --scripttools
--declarative --release -nomake examples -nomake demos --static --openssl -I
/usr/local/ssl/include -L /usr/local/ssl/lib -confirm-license -sql-qsqlite
-sql-qmysql -sql-qodbc
I am using Qt 4.7.1 and embedded a webview in my app. But I got the following error when trying to visit http://webkit.org/demos/sticky-notes/ to test the HTML 5 database feature
Failed to open the database on disk. This is probably because the version
was bad or there is not enough space left in this domain's quota
I compiled my static Qt library with the following command:
configure --prefix=/usr/local/qt-static-release-db --accessibility --multimedia
--audio-backend --svg --webkit --javascript-jit --script --scripttools
--declarative --release -nomake examples -nomake demos --static --openssl -I
/usr/local/ssl/include -L /usr/local/ssl/lib -confirm-license -sql-qsqlite
-sql-qmysql -sql-qodbc
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
检查 QWebSettings 文档。
特别是,您必须使用 setAttribute 启用 QWebSettings::OfflineStorageDatabaseEnabled 和 使用 setOfflineStoragePath 指出本地存储位置(例如 QDesktopServices::DataLocation)。
您可能想在每个页面上执行此操作,但作为示例,可以使用以下命令在全局执行此操作:
Check QWebSettings documentation.
In particular, you have to use setAttribute to enable QWebSettings::OfflineStorageDatabaseEnabled and point out the local storage location using setOfflineStoragePath (e.g. QDesktopServices::DataLocation).
You might want to do it per-page, but as an example, doing it globally can be done using: