c++ - 在 Webview Blackberry 10 Cascades Beta 3 SDK Dev Alpha Simulator 中获取不正确的权限屏幕

标签 c++ qt permissions webview blackberry-cascades

我正在尝试让动态生成的 html 5 图表显示在 Blackberry 10 Cascades 的 WebView 中。我已经确认我生成的 html5 绘制了正确的图形。我的问题是,当我尝试在 Blackberry 10 Cascades Beta 3 SDK(使用 Blackberry 10 Dev Alpha Simulator)中实现它时,应该显示图形的 webview 看起来像这样:

Error: This file could not be opened. Check that you have the correct permissions and try again.

这是导致此错误的代码:

//html_ already contains the html-5 code to make the graph at this point in the code

//This is the file path to a local file that is actually accessable in the emulator
//and not just from Windows
//
QFile *chartFile = new QFile("app/native/assets/data/chart.html");

if (chartFile->open(QIODevice::WriteOnly)) {
    chartFile->write(html_.toUtf8());
    chartFile->flush();
    chartFile->close();
}

if (chartFile) delete chartFile;

if (graphView_) {
    graphView_->setHtml("");
    graphView_->setUrl(QUrl::fromLocalFile("app/native/assets/data/chart.html"));
}

我检查了那个文件的权限,把它们都设置为允许(777 权限对于那些知道 Unix 风格权限的人)。

我将 access_internet 添加到 bar-descriptor.xml,尽管我的应用程序已经能够访问远程站点,只是想看看是否可以修复它,但它没有。

我一直在寻找解决这个问题的方法,但我没有。

如果有人能帮我解决这个问题,我将不胜感激。

-------------------------------------------- --------


更新:

我更改了代码以直接设置 html,现在我有这个:

if (graphView_) {
    graphView_->setHtml(html_, QUrl("app/native/assets/data/chart.html"));
}

但是没有任何显示。看来我的相对于我的基本 url 的相对路径是错误的。

我的基本 url 是这样的:QUrl("app/native/assets/data/chart.html")

我的相对路径都以:./Highcharts/js/...开头

我的相对路径位于:app/native/assets/data/Highcharts/js

在我看来,我应该这样做,但是当我这样做时,我只是一个空白屏幕,好像它找不到我的相对路径。所以我也不知道这里发生了什么。

最佳答案

我找到了一个有效的解决方案。我使用的是第一种方法,而不是更新的方法,而是

graphView_->setUrl(QUrl("app/native/assets/data/chart.html"));

我正在使用:

graphView_->setUrl(QUrl("local:///assets/data/chart.html"));

我让其余的代码保持不变,并且可以正常工作。

关于c++ - 在 Webview Blackberry 10 Cascades Beta 3 SDK Dev Alpha Simulator 中获取不正确的权限屏幕,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13591062/

相关文章:

python - 从 QLayout 中的 QTabBar 中删除填充/边距

c# - Winforms 中的 System.UnauthorizedAccessException C#

c++ - 什么会导致 cout << variable << "\t";当输出超过终端宽度时打印空格而不是值?

c++ - 'YYSTYPE' 没有成员

c++ - 为什么这段将 std::array 转换为 std::string 的代码不显示任何内容?

C++链表从最高到最低错误排序

c++ - wxWidgets画波形比qt更好是因为原生函数支持吗?

qt - Row和RowLayout有什么区别?

android - Firebase + 权限

java - Android Marshmallow 6.0 webview 在运行时请求权限位置