2017-08-23 8 views
1

新しいqtクイックプロジェクトのテンプレートにイメージを追加しようとすると、コンパイルされてウィンドウが表示されますが、編集テキストと四角形だけが表示されます。Qtクイックイメージが表示されない

import QtQuick 2.6 

Rectangle { 
    property alias mouseArea: mouseArea 
    property alias textEdit: textEdit 

    width: 360 
    height: 360 

    MouseArea { 
    id: mouseArea 
    anchors.fill: parent 
    } 

    TextEdit { 
    id: textEdit 
    text: qsTr("Enter some text...") 
    verticalAlignment: Text.AlignVCenter 
    anchors.top: parent.top 
    anchors.horizontalCenter: parent.horizontalCenter 
    anchors.topMargin: 20 
    Rectangle { 
     anchors.fill: parent 
     anchors.margins: -10 
     color: "transparent" 
     border.width: 1 
    } 
    } 
    Image { 
    id: image 
    x: 207 
    y: 235 
    width: 100 
    height: 100 
    source: "../../QtIcon.png" 
    } 

}

+0

qrcリソースエディタを使用して解決し、画像を追加しました:) – pythonner

答えて

0

あなたはファイル追加して、ファイルシステム内の画像を使用することができます://インフロントを。 例:source: "file:// C:/test.png"

+0

ありがとう、これは第2の選択肢です。しかし、それはリソースエディタを使って解決されます。 – pythonner

関連する問題