Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Qcamera for android

Qcamera for android

Scheduled Pinned Locked Moved Mobile and Embedded
5 Posts 3 Posters 3.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    leafjungle
    wrote on last edited by
    #1

    Hello, everyone.

    I have trouble in using qcamera for an android app.

    in the GUI, I use a horizontal layout: hlayout. then the code is:

    ui->setupUi(this);

    this->camera = new QCamera(this);
    this->viewfinder = new QCameraViewfinder(this);
    ui->hlayout->addWidget(viewfinder);
    camera->setCaptureMode(QCamera::CaptureStillImage);
    camera->setViewfinder(viewfinder);
    camera->start();
    cout<<"camera status:"<<this->camera->status()<<"#"<<endl;
    this->camera->status();//I do not know how to use this status, because it can not be printed
    camera->availability();//I do not know how to use this status, because it can not be printed

    When the app starts, the android system does tip me that this app wants the camera, but nothing is displayed in the hlayout.

    What is the situation now?

    Thanks in advance.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      You should also add which version of Qt you are using. IIRC, painting the camera on widget was not supported (I don't know the state for 5.4) However QML can be used to interact with the camera.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • L Offline
        L Offline
        leafjungle
        wrote on last edited by
        #3

        Thanks for you kindly reply.

        The QT version I use is:5.3.1

        Is there any example to show how to show the camera on a widget?

        and also examples to interact with the camera by QML?

        [quote author="SGaist" date="1409397873"]Hi,

        You should also add which version of Qt you are using. IIRC, painting the camera on widget was not supported (I don't know the state for 5.4) However QML can be used to interact with the camera.[/quote]

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Like I wrote, AFAIK, the QCamera class is not usable as is with QWidget on Android with that version of Qt. One thing to do is check with the latest 5.4 testing package to see whether it improves.

          You have the camera examples in Qt's documentation that you can use for that.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • S Offline
            S Offline
            shane
            wrote on last edited by shane
            #5

            to print the status of camera, follow this:

             connect(camera, SIGNAL(statusChanged(QCamera::Status)), this, SLOT(statusChanged(QCamera::Status)));
            

            and then deal with it in your own function statusChanged(QCamera::Status status).

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved