2017-11-22 1 views
1

Qt5 Documentation에 따르면 tiff 파일을 읽을 수 있습니다. 하지만 QML에 tiff 이미지를로드 할 수 없습니다.QML에 * .tiff 파일을로드하는 방법

내 코드 : 것 같다

Rectangle{ 
    id:backazimuth_image 
    anchors.horizontalCenter: parent.horizontalCenter 
    height:geri.height 
    width:geri.width 
    Image { 
     id:geri 
     width: 300 
     height: 300 
     fillMode: Image.PreserveAspectFit 
     source:"../images/geri.tiff" 
    } 
} 

답변

1

당신이 당신의 QRC 자원 파일에 TIF 파일이 없습니다. file을 추가하십시오.

예 :

import QtQuick 2.7 
import QtQuick.Controls 2.0 

ApplicationWindow { 
    id: window 
    visible: true 
    width: 640 
    height: 480 
    title: qsTr("") 

    Rectangle 
    { 
     id: myRect 
     height: 200 
     width: 200 

     Image 
     { 
      width: 100 
      height: 100 
      fillMode: Image.PreserveAspectFit 
      source: "file:///home/user/dir/file.tif" 
     } 
    } 
} 
+1

그것은 QRC 파일에 추가 한 후 작동합니다. 고맙습니다. –

관련 문제