配置 Qt 项目
创建新项目:
打开 Qt Creator,选择“新建项目”,然后选择“Qt Widgets Application”或“Qt Quick Application”。
设置交叉编译工具链:
在项目的配置中,选择使用 STM32MP1 的交叉编译工具链。
配置 Qt 版本为交叉编译版本。
编写代码:
在 Qt Creator 中编写简单的 GUI 应用程序。下面是一个基本的示例:
cpp
#include <QApplication>
#include <QPushButton>
#include <QWidget>
int main(int argc, char *argv[]) {
QApplication app(argc, argv);
QWidget window;
window.setFixedSize(400, 300);
QPushButton *button = new QPushButton("Hello, STM32MP1!", &window);
button->setGeometry(100, 100, 200, 50);
window.show();
return app.exec();
}
|