简体   繁体   English

将Qt QML应用程序部署到Android时黑屏

[英]Blank screen while deploying Qt QML application to Android

I have downloaded Android Studio and I am using a x86 AVD to run my application. 我已经下载了Android Studio,并且正在使用x86 AVD运行我的应用程序。 I am able to deploy my application to the emulator but it always shows a blank white screen. 我可以将应用程序部署到仿真器,但始终显示空白屏幕。 This happens only if my application has some QML code, if I run a pure C++ example then the app is correctly displayed. 仅当我的应用程序具有一些QML代码时才会发生这种情况,如果我运行纯C ++示例,则该应用程序将正确显示。 Code below. 下面的代码。

import QtQuick 2.6
import QtQuick.Controls 1.0
ApplicationWindow{
    color: "blue"
    height: 500; width: 400
    Text {
        id: name
        text: qsTr("text")
        anchors.centerIn: parent
    }
}

http://doc.qt.io/qt-5/qml-qtquick-controls-applicationwindow.html#details says: http://doc.qt.io/qt-5/qml-qtquick-controls-applicationwindow.html#details说:

Note: By default, an ApplicationWindow is not visible. 注意:默认情况下, ApplicationWindow不可见。

So you have to set 所以你必须设置

visible: true

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM