Android QT-qml图像定向

Android QT-qml图像定向,android,image,qt,qml,orientation,Android,Image,Qt,Qml,Orientation,我正在尝试使用Qt为android构建一个应用程序。 我写了一个非常简单的代码来帮助回答我的问题 import QtQuick 2.9 import QtQuick.Controls 2.2 ApplicationWindow { property string imagePath: "/storage/emulated/0/DCIM/camera/20180910_141351.jpg" visible: true Image { id: picture ancho

我正在尝试使用Qt为android构建一个应用程序。
我写了一个非常简单的代码来帮助回答我的问题

import QtQuick 2.9
import QtQuick.Controls 2.2
ApplicationWindow {
  property string imagePath: "/storage/emulated/0/DCIM/camera/20180910_141351.jpg"
  visible: true
  Image {
    id: picture
    anchors.fill: parent
    fillMode: Image.PreserveAspectFit
    source: "file://" + imagePath
  }
}
我正在尝试将手机中的图像添加到应用程序中,我面临的问题如下:

  • 如果图像是由相机拍摄的,则图像会在应用程序内旋转显示(如果图像最初是纵向的,则显示为横向的,反之亦然)
  • 如果图像不是由相机拍摄的,例如从web保存的图像,则会正确显示
  • 有没有办法通过qml自动修复此问题?或者我必须按代码旋转图像吗


    另外,如果我必须写一个代码来做旋转,我怎么知道图像的方向?请注意,在某些情况下,我可能有一个图像列表,因此我需要旋转所有图像。

    您是否尝试过使用
    自动转换属性?(只是一个想法,我不知道它是否有效)该死,那很容易。谢谢,它解决了这个问题