QCamera (on Windows 7) re-sizing does not work, window grows only bigger not smaller.



  • I just want a simple Camera webcam vieuwer in my App.

    The code below works, but the window can only be size bigger, smaller does not work.
    Also KeepaspectRation isnt working,etither

    1. How can I solve this?
    2. I want to draw a simple cross with 2 lines over the camera image view, how can I do that?
    3. How can I show the image in e.g. a QLabel?

    This is my code, standard Qt creator project:

    CameraWindow::CameraWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::CameraWindow)
    {
    ui->setupUi(this);

    //QAbstractVideoSurface
    
    camera = new QCamera;
    viewFinder = new QCameraViewfinder;
    viewFinder->setAspectRatioMode(Qt::KeepAspectRatioByExpanding);
    viewFinder->show();
    
    camera->setViewfinder(viewFinder);
    camera->setCaptureMode(QCamera::CaptureStillImage);
    camera->start();
    this->setCentralWidget(viewFinder);
    

    }


Log in to reply
 

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