-
Suggestion
-
Resolution: Done
-
Not Evaluated
-
5.7, 6.0.2
-
None
-
OS X, Qt 5.7
-
-
38cb0e9a74bf44413590b96767773b3138ad6666 (qt/qtdeclarative/dev)
On OS X, the following code fails:
FileDialog {
folder: shortcuts.documents
selectExisting: false
onAccepted: {
content.grabToImage(function(result){
if (!result.saveToFile(fileUrl)){
console.error('Unknown error');
}
});
}
}
The workaround is to convert the fileUrl to a string, and remove the protocol:
FileDialog {
folder: shortcuts.documents
selectExisting: false
onAccepted: {
var urlNoProtocol = (fileUrl+"").replace('file://','');
content.grabToImage(function(result){
if (!result.saveToFile(fileNoProtocol)){
console.error('Unknown error saving',fileNoProtocol);
}
});
}
}
Related Stack Overflow question: http://stackoverflow.com/q/39939565/405017
- depends on
-
QTBUG-46430 QML url type needs more features
-
- Closed
-
| For Gerrit Dashboard: QTBUG-56436 | ||||||
|---|---|---|---|---|---|---|
| # | Subject | Branch | Project | Status | CR | V |
| 337402,6 | Add QQuickItemGrabResult::saveToFile(QUrl) overload | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |