[英]Qt: How to save an image in asset from url?
是否可以从资产文件夹中的URL保存图像?
void DataPacking::createAndSaveImage(QString argSavingFilePath,
QByteArray argDataLoaded) {
m_file = new QFile;
m_file->setFileName(argSavingFilePath);
m_file->open(QIODevice::WriteOnly);
m_file->write(argDataLoaded);
m_file->close();
m_file->~QFile();
}
m_savingFilePath = QDir::homePath() + "app/native/assets/images/"
+ QString("multipleActive.png");
createAndSaveImage(m_savingFilePath, m_dataLoaded);
但是当我尝试使用此图像时,出现以下错误。
“无法在(/apps/com.bluewave.LeasePlan.testDev_e_LeasePlan45b0f435/native/assets/)中获取资产:(/images/multipleActive.png)。”
资产目录(或更恰当的说是应用程序目录)是应用程序沙箱受保护区域的一部分,无法更改。 如果要将数据存储在沙箱中,则应使用数据目录。
参见: https : //developer.blackberry.com/native/documentation/cascades/device_platform/data_access/file_system.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.