![]() |
N9, QCamera signal/slots not working
Not sure what I'm doing wrong, I've used signals/slots before, but it doesn't seem to fire for me on this.
Trying to figure out how all the QCamera stuff works, so first step would be taking a picture and saving it to file. If anyone would have a clue as to why the imageSaved() isn't firing (I've tried it on a bunch of different signals, tried it with the QCamera::Status and State, it never gets fired for whatever I set it as). Qt documentation isn't much help, their example they give explains nothing, doesn't tell you how the file is saved (if at all), if at all or where to set the file location or names (or I've just missed it). Code:
private slots: Code:
void MainWindow::on_pushButton_clicked() |
Re: N9, QCamera signal/slots not working
Hmm. I think most camera apps today are by default going to use the "Design rule for Camera File" system, so all the pictures are going to be stored in the DCIM directory. That'd be the place to look to confirm if a file has been created or not.
I haven't tried using the QCamera or QCameraImageCapture before, but it looks to me like most of the functions -- start(), searchAndLock(), capture(), etc. -- are non-blocking. So, after running "start()", you can't immediately call "searchAndLock()"; you have to instead catch the appropriate "stateChanged()" signal, and fire the call once you've gotten that. And then catch a signal from that one in order to call "capture()", etc. Also, both objects appear to have an "error()" signal, which might be helpful to connect; there's probably some useful info coming back from them. :) EDIT: Hmm, yeah, their example code doesn't show them waiting for signals. :( Maybe these methods do block... EDIT2: Ah, no, their example is simply incomplete (and annoyingly so). Instead of actually giving you a working example, they give you pieces of an example, along with comments (like "on shutter button pressed") that hint at what the rest of the code should be (such as connecting to a shutter button pressed signal)... |
Re: N9, QCamera signal/slots not working
Ended up finding another example, also figured out how along what exactly "saves" the file.
the ->capture has an optional param for location, so ->capture("/home/user/etcetc") Anywho, I've got the QCamera going to a slot for when the status changes to "Active", then it tries the ->capture. Also added an error slot, which ends up shooting out "QCameraImageCapture::NotReadyError". Now to figure out why it's not ready |
Re: N9, QCamera signal/slots not working
Got it!
Thanks for the awesome idea of checking the error signal :P Code:
connect(m_stillImageCapture, SIGNAL(readyForCaptureChanged(bool)), this, SLOT(ready(bool))); Awesomeeee. |
All times are GMT. The time now is 21:56. |
vBulletin® Version 3.8.8