×
Namespaces

Variants
Actions
(Difference between revisions)

Still Image capture using Qt Mobility

From Nokia Developer Wiki
Jump to: navigation, search
teemup (Talk | contribs)
(Added correct categories.)
hamishwillee (Talk | contribs)
m (Remove platform specifier categories (only need specifier for Qt if there is some platform specific behaviour). Add multimedia (technology most associated with Camera))
Line 1: Line 1:
[[Category:Qt]][[Category:Qt for Symbian]][[Category:Qt Mobility]]
+
[[Category:Qt Mobility]]
 
{|style="background:#eceff2" width="660px" border="1" cellpadding="5" cellspacing="0"  
 
{|style="background:#eceff2" width="660px" border="1" cellpadding="5" cellspacing="0"  
 
|-
 
|-
Line 8: Line 8:
 
|'''Tested on devices''' || Nokia N97 Mini
 
|'''Tested on devices''' || Nokia N97 Mini
 
|-
 
|-
|'''Category''' || Qt for Symbian
+
|'''Category''' || Qt Mobility API
|'''Subcategory''' || Qt Mobility API
+
|'''Subcategory''' || Multimedia
 
|-
 
|-
 
|}
 
|}
Line 19: Line 19:
 
|}
 
|}
  
{{Tip| Read this article before moving forward: [[Setting up environment for Qt Mobility API]]}}
 
  
 
== Overview ==  
 
== Overview ==  
Still Image capture using Qt Mobility
+
{{Abstract|visible=true|Still Image capture using Qt Mobility}}
  
 
== Keywords ==
 
== Keywords ==
Line 127: Line 126:
 
* SDK help
 
* SDK help
 
--[[User:Skumar rao|Skumar rao]] 16:28, 27 March 2010 (UTC)
 
--[[User:Skumar rao|Skumar rao]] 16:28, 27 March 2010 (UTC)
 +
 +
[[Category:Multimedia]]

Revision as of 03:38, 15 April 2011

ID Creation date 27th Mar 2010
Platform S60 5th Edition Tested on devices Nokia N97 Mini
Category Qt Mobility API Subcategory Multimedia


Keywords (APIs, classes, methods, functions): QCamera, QStillImageCapture


Contents

Overview

Still Image capture using Qt Mobility

Keywords

Project configuration file (.Pro file)

  • Add the Qt Mobility project configuration option in the .Pro file as shown below
CONFIG += mobility
MOBILITY += multimedia

Header File

#include <qcamera.h>
#include <qstillimagecapture.h>
 
public slots:
void captureImage();
void error(QCamera::Error);
void imageCaptured(const QString &fileName, const QImage &preview);
private:
void InitCamera();
 
private:
QCamera* m_camera;
QStillImageCapture* m_stillImageCapture;

Source File

void ImageCapture::InitCamera() {
QByteArray cameraDevices = QCamera::availableDevices()[0];
m_camera = new QCamera(cameraDevices);
 
connect(m_camera, SIGNAL(error(QCamera::Error)), this, SLOT(error(QCamera::Error)));
 
m_camera->setFocusMode(QCamera::AutoFocus);
 
m_stillImageCapture = new QStillImageCapture(m_camera);
connect(m_stillImageCapture, SIGNAL(imageCaptured(QString,QImage)), this, SLOT(imageCaptured(QString,QImage)));
 
if (m_camera->state() == QCamera::ActiveState) {
m_camera->stop();
}
m_camera->start();
}
void ImageCapture::error(QCamera::Error e) {
switch (e) {
case QCamera::CameraError: {
QMessageBox::warning(this, "Camera error", "General camera error");
break;
}
case QCamera::NotReadyToCaptureError: {
QMessageBox::warning(this, "Camera error", "Camera not ready to capture image");
break;
}
case QCamera::InvalidRequestError: {
QMessageBox::warning(this, "Camera error", "Invalid request");
break;
}
case QCamera::ServiceMissingError: {
QMessageBox::warning(this, "Camera error", "Service missing");
break;
}
case QCamera::NotSupportedFeatureError: {
QMessageBox::warning(this, "Camera error", "Not supported feature");
break;
}
default:
break;
};
}
void ImageCapture::captureImage() {
if (m_stillImageCapture->isReadyForCapture()) {
m_stillImageCapture->capture(QString("camera_capture.jpg"));
}
else {
QMessageBox::warning(this, "Camera error", "Camera not ready");
}
 
}
void ImageCapture::imageCaptured(const QString &fileName, const QImage &preview) {
QMessageBox::information(this, "Image Capatured", fileName);
}

Classes

  • QCamera
  • QStillImageCapture

Reference links

--skumar_rao 16:28, 27 March 2010 (UTC)

149 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×