Change Viewfinder Resolution in qt C++
-
Hey Guys!!!! Once again in trouble. I am trying to change viewfinder resolution at run time but unfortunately, application is closing..
Let me explain you in detail:-- Initially i am setting my viewfinder resolution to the last supported viewfinder resolutions (say 1280 x 720) and then with the help of combo box i am selecting another resolution (say 640 x 480)
- After selecting another resolution, my program is finishing unexpectedly.
Anybody with the solution please.. Regrets for silly mistakes.
Here is the sample snippet....mCameraViewFinder = new QCameraViewfinder; mCameraImageCapture = new QCameraImageCapture(mCamera,this); mCamera->start(); QList<QSize> res = mCamera->supportedViewfinderResolutions(); QSize selectedRes; if(!res.isEmpty()) { selectedRes = res.takeLast(); } else { qDebug()<<"Empty Resolution!!!"; } viewfindersettings.setResolution(selectedRes); //Here current resolution is 1280*720 mCamera->setViewfinderSettings(viewfindersettings); //After selecting resolution from combo box viewfindersettings.setResolution(n,n1); //Here n and n1 are 640 and 480 respectively mCamera->setViewfinderSettings(viewfindersettings); mCamera->setViewfinder(ui->viewfinder); mCamera->start();
Need some help...
-
Hi,
What does a run through the debugger tell you ?
-
Do you mean that mCamera is a null pointer ?
-
-
@Praveen-k Use some other site where login is not required.
https://postimage.org
http://tinypic.com -
The
camera
object itself seems to be null. Are you sure it's initialized correctly ? -
Ok. if i have not initialized it, can you help me on how to initialize it?
I have done the initialization as below:mCamera = new QCamera(this); mCameraViewFinder = new QCameraViewfinder(this); mCameraImageCapture = new QCameraImageCapture(mCamera,this); mCamera->start();
-
It's not your
mCamera
object that is null, it's yourcamera
object. -
It's your own custom class, how can I know where you use it or how you use it ?
-
Then don't create a new QCamera each time you change the resolution.