Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved Regarding the preview of the camera in Android

    General and Desktop
    2
    5
    781
    Loading More Posts
    • 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.
    • Pradeep Kumar
      Pradeep Kumar last edited by

      Hi,

      I am using Qt 5.7 version, and trying the camera application in Android, but the problem is i am not getting the preview?.
      I want to capture the image,
      I am using the code below.
      {
      this->setFixedSize(700,500);

      m_button = new QPushButton;
      m_button->setText("Start Camera");
      
      m_captureImage = new QPushButton;
      m_captureImage->setText("Capture Image");
      
      m_cameraObj=new QCamera;
      m_imageCapture = new QCameraImageCapture(m_cameraObj);
      
      m_viewfinder = new QCameraViewfinder;
      m_viewfinder->setFixedSize(400,400);
      m_viewfinder->setVisible(false);
      m_viewfinder->setSizePolicy(QSizePolicy::Maximum,QSizePolicy::Maximum);
      m_cameraObj->setViewfinder(m_viewfinder);
      
      m_hbox = new QHBoxLayout;
      m_hbox->addWidget(m_button);
      m_hbox->addWidget(m_captureImage);
      
      m_vbox = new QVBoxLayout;
      m_vbox->addLayout(m_hbox);
      m_vbox->addWidget(m_viewfinder);
      setLayout(m_vbox);
      
      connect(m_button,SIGNAL(clicked()),this,SLOT(getCameraImage()),Qt::UniqueConnection);
      connect(m_captureImage,SIGNAL(clicked()),this,SLOT(getCapturedImage()),Qt::UniqueConnection);
      

      }

      void CameraFrame::getCameraImage()
      {
      m_cameraObj->start();
      }

      void CameraFrame::getCapturedImage()
      {
      m_imageCapture->capture();
      }

      Any clue why it is not showing preview. Even with the sample code of camera which is provided by Qt is not showing preview in Android, Guidance is required.

      Thanks,
      }

      Pradeep Kumar
      Qt,QML Developer

      D 1 Reply Last reply Reply Quote 0
      • D
        Devopia53 @Pradeep Kumar last edited by

        @Pradeep-Kumar

        You can find information here.

        1 Reply Last reply Reply Quote 1
        • Pradeep Kumar
          Pradeep Kumar last edited by

          I got it we need to load QML Component to Qt .
          Add to a layout and then view.

          Pradeep Kumar
          Qt,QML Developer

          1 Reply Last reply Reply Quote 0
          • Pradeep Kumar
            Pradeep Kumar last edited by

            Hi,

            In C++ class . I used QQuickWidget Class and added to layout.
            I am getting the preview using QML Camera.

            Thanks,

            Pradeep Kumar
            Qt,QML Developer

            1 Reply Last reply Reply Quote 1
            • Pradeep Kumar
              Pradeep Kumar last edited by Pradeep Kumar

              One more query , can we have preview using QCamera?.It will be good to have.

              Guys is it still a bug?.

              Thanks,

              Pradeep Kumar
              Qt,QML Developer

              1 Reply Last reply Reply Quote 0
              • First post
                Last post