×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    May 2011
    Posts
    22

    Problem when using QCamera

    Hello!
    I learning QMobility, i write a camera app using QCamera and QCameraViewFinder , but it display black background . I find in froum, but i don't know debug it.
    My code:
    Code:
    #include "mainwindow.h"
    #include <QtGui/QApplication>
    #include <QCamera>
    #include <QCameraViewfinder>
    int main(int argc, char *argv[])
    {
        QApplication app(argc, argv);
    
        MainWindow mainWindow;
        mainWindow.setOrientation(MainWindow::ScreenOrientationAuto);
    //    mainWindow.showExpanded();
    
        QCamera* camera;
        QCameraViewfinder* viewfinder;
    
        camera = new QCamera();
        viewfinder = new QCameraViewfinder();
    
        viewfinder->show();
        camera->setViewfinder(viewfinder);
    
        camera->setCaptureMode(QCamera::CaptureStillImage);
        camera->start();
    
        mainWindow.setCentralWidget(viewfinder);
        mainWindow.show();
    
        return app.exec();
    }
    and notice of app
    Code:
    [Qt Message] Failed to create camera. Possibly missing capabilities.
    [Qt Message] Failed to create camera settings handler.
    [Qt Message] Camera error: "Failed to set viewfinder" 
    [Qt Message] Object::disconnect: Unexpected null parameter
    [Qt Message] Failed to recover from error.
    [Qt Message] Camera error: "Recovering from error failed. Possibly missing capabilities." 
    [Qt Message] Camera error: "Unexpected camera error." 
    [Qt Message] Object::disconnect: Unexpected null parameter
    [Qt Message] Failed to recover from error.
    [Qt Message] Camera error: "Recovering from error failed. Possibly missing capabilities."
    Help me!

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,179

    Re: Problem when using QCamera

    you could check a working example from: http://doc.qt.nokia.com/4.7-snapshot...e-qcamera.html

    anyway, you could start by checking the capabilities defined in: http://doc.qt.nokia.com/4.7-snapshot...amera-pro.html and see that you have the same.

  3. #3
    Super Contributor
    Join Date
    Mar 2009
    Posts
    1,024

    Re: Problem when using QCamera

    I think it doesn't work because the camera is started before that the viewfinder widget is shown.

    Solution: Move camera->start(); after mainWindow.show();

Similar Threads

  1. Qt QCamera example didn't autofocus
    By stone.chao in forum [Archived] Qt Mobility Project
    Replies: 10
    Last Post: 2011-11-16, 15:36
  2. Qcamera in N900
    By didik.wahyono in forum Nokia N9
    Replies: 3
    Last Post: 2011-05-20, 00:23
  3. QCamera::Status vs QCamera::State ?
    By tipul07 in forum Qt
    Replies: 3
    Last Post: 2011-03-08, 00:33
  4. Using QCamera
    By Arvis17 in forum [Archived] Beginning Qt
    Replies: 18
    Last Post: 2011-01-26, 17:16

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×