Qt Creator は初めてで、単純なアプリケーションを作成しようとしています。これまでのところ、メイン画面のみの非常に基本的なものに過ぎません。QML コードを作成し、OnePlus One Android フォンで実行しようとしました。Qt のサンプルはすべて正常に動作しているため、携帯電話でプログラムを実行するために必要なコンポーネントはすべて揃っています。
アプリケーションがビルドされ、デバイスにインストールされますが、空白の黒い画面で解決され、何も表示されません。考えられるさまざまな解決策を約2時間試しましたが、何も機能しませんでした。誰かが私を正しい方向に向けることができますか?
私のQMLコード(写真はディレクトリに正しく追加されています)、他のすべては変更されていません:
import QtQuick 2.3
import QtQuick.Window 2.2
import QtQuick.Controls 1.3
Window {
id: applicationWindow1
visible: true
width: 360
height: 360
color: "#343434"
Image {
id: cammbutticon
x: 208
y: 169
width: 150
height: 150
opacity: 1
fillMode: Image.PreserveAspectFit
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
source: "camera-icon.png"
Rectangle {
id: centRect
width: 150
height: 150
opacity: 1
color: "#00000000"
radius: 35
border.color: "#ef0707"
border.width: 3
MouseArea {
id: mouseAreaCam
anchors.fill: parent
onClicked: 'GO TO CAMERA'
}
}
}
Image {
id: exitman
x: 473
y: 338
width: 150
height: 120
opacity: 1
sourceSize.height: 250
sourceSize.width: 250
anchors.right: parent.right
anchors.rightMargin: -15
anchors.bottom: parent.bottom
anchors.bottomMargin: -10
source: "exitman.png"
Rectangle {
id: exitRect
x: 37
y: 12
width: 100
height: 100
opacity: 1
color: "#00000000"
radius: 35
border.width: 3
border.color: "#ef0707"
anchors.right: parent.right
anchors.rightMargin: 20
anchors.bottom: parent.bottom
anchors.bottomMargin: 15
MouseArea {
id: mouseAreaExit
anchors.fill: parent
onClicked: Qt.quit()
}
}
}
Label {
id: welcometext
width: 227
height: 130
opacity: 1
color: "#ef0707"
text: qsTr("WELCOME TO THE APPLICATION")
anchors.top: parent.top
anchors.topMargin: -8
styleColor: "#f9f9f9"
style: Text.Normal
font.bold: false
font.pointSize: 20
font.family: "Arial"
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.WordWrap
anchors.verticalCenterOffset: -123
anchors.horizontalCenterOffset: 1
anchors.centerIn: parent
}
}