×
Namespaces

Variants
Actions
(Difference between revisions)

Still Image capture using Qt Mobility

From Nokia Developer Wiki
Jump to: navigation, search
hamishwillee (Talk | contribs)
m (Text replace - "<code cpp>" to "<code cpp-qt>")
hamishwillee (Talk | contribs)
m (Hamishwillee -)
 
Line 1: Line 1:
 +
[[Category:Qt Mobility]][[Category:MeeGo Harmattan]][[Category:Symbian]][[Category:Camera]][[Category:Imaging]]
 
{{ArticleMetaData <!-- v1.2 -->
 
{{ArticleMetaData <!-- v1.2 -->
 
|sourcecode= <!-- Link to example source code e.g. [[Media:The Code Example ZIP.zip]] -->
 
|sourcecode= <!-- Link to example source code e.g. [[Media:The Code Example ZIP.zip]] -->
 
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) -->
 
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) -->
|devices= <!-- Devices tested against - e.g. ''devices=Nokia 6131 NFC, Nokia C7-00'') -->
+
|devices= Nokia N97 Mini
 
|sdk= <!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Qt SDK 1.1.4]) -->
 
|sdk= <!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Qt SDK 1.1.4]) -->
|platform= <!-- Compatible platforms - e.g. Symbian^1 and later, Qt 4.6 and later -->
+
|platform= S60 5th Edition
 
|devicecompatability= <!-- Compatible devices e.g.: All* (must have internal GPS) -->
 
|devicecompatability= <!-- Compatible devices e.g.: All* (must have internal GPS) -->
 
|dependencies= <!-- Any other/external dependencies e.g.: Google Maps Api v1.0 -->
 
|dependencies= <!-- Any other/external dependencies e.g.: Google Maps Api v1.0 -->
 
|signing= <!-- Signing requirements - empty or one of: Self-Signed, DevCert, Manufacturer -->
 
|signing= <!-- Signing requirements - empty or one of: Self-Signed, DevCert, Manufacturer -->
 
|capabilities= <!-- Capabilities required by the article/code example (e.g. Location, NetworkServices. -->
 
|capabilities= <!-- Capabilities required by the article/code example (e.g. Location, NetworkServices. -->
|keywords= <!-- APIs, classes and methods (e.g. QSystemScreenSaver, QList, CBase -->
+
|keywords= QCamera, QStillImageCapture
 
|language= <!-- Language category code for non-English topics - e.g. Lang-Chinese -->
 
|language= <!-- Language category code for non-English topics - e.g. Lang-Chinese -->
 
|translated-by= <!-- [[User:XXXX]] -->
 
|translated-by= <!-- [[User:XXXX]] -->
Line 21: Line 22:
 
|author= [[User:Skumar rao]]
 
|author= [[User:Skumar rao]]
 
}}
 
}}
[[Category:Multimedia]][[Category:Qt Mobility]]
 
{|style="background:#eceff2" width="660px" border="1" cellpadding="5" cellspacing="0"
 
|-
 
|'''ID''' ||
 
|'''Creation date''' || 27th Mar 2010
 
|-
 
|'''Platform''' || S60 5th Edition
 
|'''Tested on devices''' || Nokia N97 Mini
 
|-
 
|'''Category''' || Qt Mobility
 
|'''Subcategory''' || Multimedia
 
|-
 
|}
 
 
 
{|style="background:#eceff2" width="660px" border="1" cellpadding="5" cellspacing="0"
 
|-
 
|'''Keywords (APIs, classes, methods, functions)''': QCamera, QStillImageCapture
 
|}
 
 
  
 
== Overview ==  
 
== Overview ==  
{{Abstract|visible=true|This article demonstrate how to capture still images using Qt Mobility}}
+
{{Abstract|This article demonstrate how to capture still images using Qt Mobility}}
  
 
== Keywords ==
 
== Keywords ==
Line 147: Line 128:
 
* [http://qt.nokia.com/developer/qt-roadmap New Qt APIs Beta - Mobility Project]
 
* [http://qt.nokia.com/developer/qt-roadmap New Qt APIs Beta - Mobility Project]
 
* SDK help
 
* SDK help
--[[User:Skumar rao|Skumar rao]] 16:28, 27 March 2010 (UTC)[[Category:MeeGo Harmattan]] [[Category:Symbian]]
+
--[[User:Skumar rao|Skumar rao]] 16:28, 27 March 2010 (UTC)

Latest revision as of 05:19, 14 June 2013

Article Metadata
Tested with
Devices(s): Nokia N97 Mini
Compatibility
Platform(s): S60 5th Edition
Symbian
Article
Keywords: QCamera, QStillImageCapture
Created: skumar_rao (27 Mar 2010)
Last edited: hamishwillee (14 Jun 2013)

Contents

[edit] Overview

This article demonstrate how to capture still images using Qt Mobility

[edit] Keywords

[edit] Project configuration file (.Pro file)

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

[edit] 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;

[edit] 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);
}

[edit] Classes

  • QCamera
  • QStillImageCapture

[edit] Reference links

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

This page was last modified on 14 June 2013, at 05:19.
125 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.

×