4

我正在使用 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
4

1 回答 1

5

检查QWebSettings文档。

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

您可能希望按页面执行此操作,但作为示例,可以使用以下方法在全局范围内执行此操作:

    QWebSettings::globalSettings()->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, true);
    QWebSettings::globalSettings()->setOfflineStoragePath(QDesktopServices::storageLocation(QDesktopServices::DataLocation));
于 2010-12-27T03:03:52.667 回答