Regarding the preview of the camera in Android



  • 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

    You can find information here.



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



  • Hi,

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

    Thanks,



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

    Guys is it still a bug?.

    Thanks,


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.