3、Hello World
之前我们都喜欢用控制台举例,这次开发点新鲜的,开发GUI版的Hello World。使用QT新建QWidget程序,流程如下图


主要代码如下
// helloworld.pro
// 注意修改target.path路径,保证目录存在并且有访问权限。
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /home/linaro/Code/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
// mainwindow.cpp
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QMessageBox>
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_pushButton_clicked()
{
QMessageBox::about(this,"Tip","Hello World");
}
然后通过远程桌面运行,运行的截图如下图所示。远程桌面的访问方式请参考《玩转DragronBoard 410c系列之二:远程访问Linux系统》

4、总结
这一篇文章简单介绍了Linux下使用QT Creator开发ARM应用程序,那么习惯于Windows系统小伙伴们会问,Windows系统能不能用QT Creator开发ARM程序呢?答案是肯定的,我会在《Windows系统使用QT Creator开发ARM应用程序》一文中介绍。但是,如果真的想用QT Creator开发ARM程序,还是建议使用Linux系统,Windows系统的QT Creator开发会出一些幺蛾子。
5、下载地址
我在这里提供下我交叉编译好的QT ARM,不想自己的编译的的可以跳过第一章节。
链接:https://pan.baidu.com/s/1OOTthU7YFcnuRyE5dL9u-g
提取码:WANG
文章评论