qcameraviewfinder rotation



  • Wenn I rotate the tablet the video stream in the view finder stays in its original orientation.
    How can I rotate it. I found only code to rotate a captured image, but this in not enough.
    The user should not tilt the head to see the preview in its correct form :-)
    I dot not need a rotation for any angle, the usual simple 90 degree in the correct direction is enough.



  • You might post your code or give us a bit more details...you might have your application defined to rotate screen automatically following the actual device orientation.
    Otherwise another simple option is to use the orientation sensor to manage the viewfinder orientation :

    OrientationSensor{
            id:orient
            active:true
            property int rotAngle :90
            property bool isPortrait : true
            onReadingChanged: {
                if (reading.orientation === OrientationReading.LeftUp)
                {
                    rotAngle = -90;
                    isPortrait = false;
                }
                else if (reading.orientation === OrientationReading.RightUp)
                {
                    rotAngle = 90;
                    isPortrait = false;
                }
                else if (reading.orientation === OrientationReading.TopDown)
                {
                    isPortrait = true;
                    rotAngle = 180;
                }
                else {
                    isPortrait = true;
                    rotAngle = 0;
                }
    
            }
        }
    

Log in to reply
 

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