我是Qt的新手。我正在創建簡單的qml應用程序。 Qt版本: - QMake版本2.01a 使用Qt版本4.6.2 我在Linux系統上。 我已經創建了包含兩個按鈕(button.qml)的qml,並且還創建了C++代碼(main.cpp)。創建簡單的qml應用程序
代碼main.cpp中 `
#include<QtGui/QApplication>
#include<QtGui/QLabel>
#include"qmlapplicationviewer.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QmlApplicationViewer viewer;
viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape);
viewer.setMainQmlFile(QLatin1String("button.qml"));
viewer.showExpanded();
a.exec();
}
` 我與QMAKE & &編譯它使 並得到了錯誤的
qmlapplicationviewer.h: No such file or directory
QmlApplicationViewerâ was not declared in this scope
我試着搜索「qmlapplicationviewer.h 「和」QmlApplicationViewer「。 但無法找到它。
請幫忙。
Qt 4.6.2? QML在4.7中加入! – lpapp
@Laszlo:謝謝。這意味着我需要安裝最新版本。 – user3013022
不是最新的,但至少是一個更新的版本,除非您使用史前時間以外的單獨qml包。 – lpapp