我是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