
Originally Posted by
anda_skoa
I am confused.
You are saying it works, but also saying it doesn't?
_
Excuse me
I mean, "setMaxResulotion" function works
And the camera is set to the highest resolution after this code:
setMaxResulotion();//set highest resolution
console.log("w2:"+camera.viewfinder.resolution.width) //=> ok : highest resolution.width
console.log("h2:"+camera.viewfinder.resolution.height)//=> ok : highest resolution.height
setMaxResulotion();//set highest resolution
console.log("w2:"+camera.viewfinder.resolution.width) //=> ok : highest resolution.width
console.log("h2:"+camera.viewfinder.resolution.height)//=> ok : highest resolution.height
To copy to clipboard, switch view to plain text mode

Originally Posted by
anda_skoa
Btw, I think it is easier to just calculate the image size in your "set maximum" function and use that for comparison between offered resolutions.
E.g. something like
var largestSize = 0;
for(var i=0;i<res.length;i++) {
var currentSize = res[i].width * res[i].height;
if (currentSize > largestSize) {
largestSize = currentSize;
camera.viewfinder.resolution = Qt.size(res[i].width,res[i].height);
}
}
var largestSize = 0;
for(var i=0;i<res.length;i++) {
var currentSize = res[i].width * res[i].height;
if (currentSize > largestSize) {
largestSize = currentSize;
camera.viewfinder.resolution = Qt.size(res[i].width,res[i].height);
}
}
To copy to clipboard, switch view to plain text mode
What I meant was: don't do this after the call to capture(), do this once capture has finished.
_
I update my code:
MyToolButton{
iconSource:"images/photo.png"
tooltip: "save photo"
onClicked: {
var res = camera.supportedViewfinderResolutions();
var largestSize = 0;
for(var i=0;i<res.length;i++) {
var currentSize = res[i].width * res[i].height;
if (currentSize > largestSize) {
largestSize = currentSize;
camera.viewfinder.resolution = Qt.size(res[i].width,res[i].height);
}
}
camera.imageCapture.capture()
saveImageFileDialog.open();
}
}
MyToolButton{
iconSource:"images/photo.png"
tooltip: "save photo"
onClicked: {
var res = camera.supportedViewfinderResolutions();
var largestSize = 0;
for(var i=0;i<res.length;i++) {
var currentSize = res[i].width * res[i].height;
if (currentSize > largestSize) {
largestSize = currentSize;
camera.viewfinder.resolution = Qt.size(res[i].width,res[i].height);
}
}
camera.imageCapture.capture()
saveImageFileDialog.open();
}
}
To copy to clipboard, switch view to plain text mode
But I have still the same error.
QCameraImageCapture error: "Camera not ready for capture"
Bookmarks