Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Regarding the preview of the camera in Android

Regarding the preview of the camera in Android

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 2 Posters 1.5k Views 2 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.
  • Pradeep KumarP Offline
    Pradeep KumarP Offline
    Pradeep Kumar
    wrote on last edited by
    #1

    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
    0
    • Pradeep KumarP Pradeep Kumar

      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,
      }

      D Offline
      D Offline
      Devopia53
      wrote on last edited by
      #2

      @Pradeep-Kumar

      You can find information here.

      1 Reply Last reply
      1
      • Pradeep KumarP Offline
        Pradeep KumarP Offline
        Pradeep Kumar
        wrote on last edited by
        #3

        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
        0
        • Pradeep KumarP Offline
          Pradeep KumarP Offline
          Pradeep Kumar
          wrote on last edited by
          #4

          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
          1
          • Pradeep KumarP Offline
            Pradeep KumarP Offline
            Pradeep Kumar
            wrote on last edited by Pradeep Kumar
            #5

            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
            0

            • Login

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