I want to make a Qt Quick Application project in Qt 5.2.1(msvc2012) using Rectangle element.
Here is my main.qml:
import QtQuick 2.0
Rectangle {
width: 100
height: 100
color: "red"
}
When I run this project, building is never finished and I don't see any application window. Application output stays at:
QML debugging is enabled. Only use this in a safe environment.
Here is my main.cpp:
#include <QApplication>
#include <QQmlApplicationEngine>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:///main.qml")));
return app.exec();
}
Here is my pro file:
TEMPLATE = app
QT += qml quick widgets
SOURCES += main.cpp
RESOURCES += qml.qrc
# Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH =
# Default rules for deployment.
include(deployment.pri)
Here is my deployment.pri:
android-no-sdk {
target.path = /data/user/qt
export(target.path)
INSTALLS += target
} else:android {
x86 {
target.path = /libs/x86
} else: armeabi-v7a {
target.path = /libs/armeabi-v7a
} else {
target.path = /libs/armeabi
}
export(target.path)
INSTALLS += target
} else:unix {
isEmpty(target.path) {
qnx {
target.path = /tmp/$${TARGET}/bin
} else {
target.path = /opt/$${TARGET}/bin
}
export(target.path)
}
INSTALLS += target
}
export(INSTALLS)
Here is Compile Output:
22:21:25: Running steps for project 521msvc20123... 22:21:25: Configuration unchanged, skipping qmake step. 22:21:25: Starting: "C:\qtcreator-3.1.0\bin\jom.exe" C:\qtcreator-3.1.0\bin\jom.exe -f Makefile.Debug C:\QtDva\5.2.1\msvc2012\bin\rcc.exe -name qml ..\521msvc20123\qml.qrc -o debug\qrc_qml.cpp cl -c -nologo -Zm200 -Zc:wchar_t -Zi -MDd -GR -W3 -w34100 -w34189 -EHsc /Fddebug\521msvc20123.pdb -DUNICODE -DWIN32 -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG -DQT_QUICK_LIB -DQT_QML_LIB -DQT_WIDGETS_LIB -DQT_NETWORK_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_OPENGL_ES_2 -DQT_OPENGL_ES_2_ANGLE -I"........\QtDva\5.2.1\msvc2012\include" -I"........\QtDva\5.2.1\msvc2012\include\QtQuick" -I"........\QtDva\5.2.1\msvc2012\include\QtQml" -I"........\QtDva\5.2.1\msvc2012\include\QtWidgets" -I"........\QtDva\5.2.1\msvc2012\include\QtNetwork" -I"........\QtDva\5.2.1\msvc2012\include\QtGui" -I"........\QtDva\5.2.1\msvc2012\include\QtANGLE" -I"........\QtDva\5.2.1\msvc2012\include\QtCore" -I"debug" -I"." -I"........\QtDva\5.2.1\msvc2012\mkspecs\win32-msvc2012" -Fodebug\ @C:\Users\Vladimir\AppData\Local\Temp\qrc_qml.obj.7128.454.jom qrc_qml.cpp echo 1 /* CREATEPROCESS_MANIFEST_RESOURCE_ID / 24 / RT_MANIFEST / "debug\521msvc20123.exe.embed.manifest">debug\521msvc20123.exe_manifest.rc if not exist debug\521msvc20123.exe if exist debug\521msvc20123.exe.embed.manifest del debug\521msvc20123.exe.embed.manifest if exist debug\521msvc20123.exe.embed.manifest copy /Y debug\521msvc20123.exe.embed.manifest debug\521msvc20123.exe_manifest.bak 1 file(s) copied. link /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /SUBSYSTEM:WINDOWS "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='' processorArchitecture=''" /MANIFEST /MANIFESTFILE:debug\521msvc20123.exe.embed.manifest /OUT:debug\521msvc20123.exe @C:\Users\Vladimir\AppData\Local\Temp\521msvc20123.exe.7128.2875.jom if exist debug\521msvc20123.exe_manifest.bak fc /b debug\521msvc20123.exe.embed.manifest debug\521msvc20123.exe_manifest.bak >NUL || del debug\521msvc20123.exe_manifest.bak if not exist debug\521msvc20123.exe_manifest.bak rc.exe /fodebug\521msvc20123.exe_manifest.res debug\521msvc20123.exe_manifest.rc if not exist debug\521msvc20123.exe_manifest.bak link /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /SUBSYSTEM:WINDOWS "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='' processorArchitecture='*'" /MANIFEST /MANIFESTFILE:debug\521msvc20123.exe.embed.manifest /OUT:debug\521msvc20123.exe @C:\Users\Vladimir\AppData\Local\Temp\521msvc20123.exe.7128.2891.jom if exist debug\521msvc20123.exe_manifest.bak del debug\521msvc20123.exe_manifest.bak 22:21:32: The process "C:\qtcreator-3.1.0\bin\jom.exe" exited normally. 22:21:32: Elapsed time: 00:08.
What can be the problem?
Qt QQmlApplicationEngine refuse to display qml code is not about the Rectangle element, its about the missing visible property in ApplicationWindow element.