0
我沒有在默認的qt creator應用程序中更改任何內容,所以一切都應該沒問題。我創建了新項目並嘗試編譯和運行。編譯過程沒問題,但運行後,main.qml沒有找到,所以我只看到沒有任何接口的黑色窗口(應該是hello world文本)。從新項目Qt - Quick 2應用程序(未找到main.qml文件)
qml1.pro
# Add more folders to ship with the application, here
folder_01.source = qml/qml1
folder_01.target = qml
DEPLOYMENTFOLDERS = folder_01
# Additional import path used to resolve QML modules in Creator's code model
QML_IMPORT_PATH =
# If your application uses the Qt Mobility libraries, uncomment the following
# lines and add the respective components to the MOBILITY variable.
# CONFIG += mobility
# MOBILITY +=
# The .cpp file which was generated for your project. Feel free to hack it.
SOURCES += main.cpp
# Installation path
# target.path =
# Please do not modify the following two lines. Required for deployment.
include(qtquick2applicationviewer/qtquick2applicationviewer.pri)
qtcAddDeployment()
的main.cpp
#include <QtGui/QGuiApplication>
#include "qtquick2applicationviewer.h"
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QtQuick2ApplicationViewer viewer;
viewer.setMainQmlFile(QStringLiteral("qml/qml1/main.qml"));
viewer.showExpanded();
return app.exec();
}
控制檯輸出從製作者的應用程序運行之後:
QML debugging is enabled. Only use this in a safe environment.
file:///Users/Krab/projects/qtProjects/build-qml1-Desktop_Qt_5_1_1_clang_64bit-Ladění/qml1.app/Contents/Resources/qml/qml1/main.qml: File not found