QML Camera does not get FULL SCREEN

Asked

Viewed 94 times

0

I’m developing an app that requires the front camera to occupy the entire background screen, like the Snapchat app, but using QML the camera with spacing above and below the camera. QML Responsible for the camera:

import QtQuick 2.4
import QtQuick.Controls 1.3
import QtQuick.Layouts 1.1
import QtMultimedia 5.5
import QtQuick.Window 2.2

Item {
    id: item1
    width: 720
    height: 1080

    property alias camera: camera
    property alias video: video

    Camera {
        id: camera

        imageProcessing.whiteBalanceMode: CameraImageProcessing.WhiteBalanceFlash

        flash.mode: Camera.FlashRedEyeReduction

    }

    VideoOutput {
        id : video
        anchors.fill: parent

        orientation: -90
        source: camera
        focus : visible // to receive focus and capture key events when visible
    }

}
  • The Item where you’re putting the camera has 720x1080px. That’s the ratio of the camera image?

  • The Item has yes, and the resolution of the cell phone screen is 720x1080

  • 1

    Try fillMode: VideoOutput.PreserveAspectCrop within the VideoOutput.

1 answer

1

Good!

Since the parent item has 1080*720 if you want the camera stretched to this resolution, fillMode: Videooutput.Stretch

VideoOutput {
    id : video
    anchors.fill: parent
    //Adiciona isto...
    fillMode: VideoOutput.Stretch
    orientation: -90
    source: camera
    focus : visible // to receive focus and capture key events when visible
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.