如何让Qt支持HTML 5数据库?

发布于 2024-10-09 02:22:49 字数 730 浏览 12 评论 0原文

我正在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

寂寞花火° 2024-10-16 02:22:49

检查 QWebSettings 文档。

特别是,您必须使用 setAttribute 启用 QWebSettings::OfflineStorageDatabaseEnabled 和 使用 setOfflineStoragePath 指出本地存储位置(例如 QDesktopServices::DataLocation)。

您可能想在每个页面上执行此操作,但作为示例,可以使用以下命令在全局执行此操作:

    QWebSettings::globalSettings()->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, true);
    QWebSettings::globalSettings()->setOfflineStoragePath(QDesktopServices::storageLocation(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:

    QWebSettings::globalSettings()->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, true);
    QWebSettings::globalSettings()->setOfflineStoragePath(QDesktopServices::storageLocation(QDesktopServices::DataLocation));
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文