.pro
+++++++++++++++++++++++++++++++++++++++++++++
#-------------------------------------------------
#
# Project created by QtCreator 2012-03-15T09:57:33
#
#-------------------------------------------------
QT += declarative quick
TARGET = Qt5Test
TEMPLATE = app
SOURCES += main.cpp
OTHER_FILES += test.qml
main.cpp
+++++++++++++++++++++++++++++++++++++++++++++++++++
#include <QQuickView>#include <QGuiApplication>#include <QDeclarativeEngine>#include <QObject>Q_DECL_EXPORT int main(int argc, char *argv[]){QGuiApplication app(argc, argv, 5);QQuickView viewer;QObject::connect(viewer.engine(), SIGNAL(quit()), QCoreApplication::instance(), SLOT(quit()));viewer.setSource(QUrl::fromLocalFile("test.qml"));viewer.show();
return app.exec();}.qml+++++++++++++++++++++++++++++++++++++++++++++++++++++import QtQuick 2.0Rectangle {width: 640height: 480Text {anchors.centerIn: parenttext: qsTr("\u6211\u662f\u4e2d\u6587Hello Qt")}
MouseArea {anchors.fill: parentonClicked: {Qt.quit();
}
}
}参考:http://qt-project.org/forums/%20/viewthread/13857http://qt-project.org/forums/viewthread/6907