QT-learning

如有侵权,联系删除。
构建系统(build system)是用来从源代码生成用户可以使用的目标(targets)的自动化工具。
目标可以包括库、可执行文件、或者生成的脚本等等。
常用的构建系统包括GNU Make、GNU autotools、CMake、Apache Ant(主要用于JAVA)。
此外,所有的集成开发环境(IDE)比如Qt Creator、Microsoft Visual Studio和Eclipse都对他们支持的语言添加了自己的构建系统配置工具。
通常IDE中的构建系统只是基于控制台的构建系统(比如Autotool和CMake)的前端。

创建项目名称的时候不可以有空格,命名要用英文,不可以出现中文。
文件路径不要出现中文。

Class information:
QWidget(父类):创建一个空白窗口。
QMainWindow(子类):在空白窗口的基础里,有菜单栏、工具栏、状态栏等信息。
QDialog(子类):创建一个对话框。

1 命名规范:
类名 首字母大写,单词和单词之间首字母大写
函数名 变量名称 首字母小写,单词和单词之间首字母大写

2 快捷键
注释 ctrl + /
运行 ctrl + r
编译 ctrl + b
查找 ctrl + f
整行移动 ctrl + shift + “上键或者下键”
帮助文档 F1
自动对齐 ctrl + i
同名之间的.h和.cpp切换 F4

帮助文档的地址为G:\QT\5.12.2\mingw73_64\bin

3 按钮控件常用API
3.1创建 QPushButton * btn = new QPushButton
3.2设置父亲 setParent(this)
3.3设置文本 setText(“文字”)
3.4设置位置 move(宽,高)
3.5重新指定窗口大小 resize
3.6设置窗口标题 setWindowTitle
3.7设置窗口固定大小 setFixedSize

4对象树
4.1当创建的对象在堆区时候,如果指定的父亲是QObject派生下来的类或者QObject子类派生下来的类,可以不用管理释放的操作,将对象会放入到对象树中。
4.2一定程度上简化了内存回收机制

5Qt中的坐标系
5.1左上角为 0 , 0 点
5.2x以右为正方向
5.3y以下为正方向

6 信号和槽
6.1连接函数 :connect
6.2参数
6.2.1参数1 信号的发送者
6.2.2参数2 发送的信号(函数地址)
6.2.3参数3 信号的接受者
6.2.4参数4 处理的槽函数 (函数的地址)
6.3松散耦合
6.4实现 点击按钮 关闭窗口的案例
6.5connect(btn , &QPushButton::click , this , &QWidget::close );

7 自定义信号和槽
7.1自定义信号
7.1.1写到 signals下
7.1.2返回 void
7.1.3需要声明,不需要实现
7.1.4可以有参数 ,可以重载
7.2自定义槽函数
7.2.1返回void
7.2.2需要声明 ,也需要实现
7.2.3可以有参数 ,可以重载
7.2.4写到 public slot下 或者public 或者全局函数
7.3触发自定义的信号
7.3.1emit 自定义信号

数据采集系统简介
1 什么是数据采集?
数据​采集​(DAQ)​是​使用​计算​机​测量​电压、​电流、​温度、​压力、​振动​或​声音​等​电子​或​物理​现象​的​过程。 DAQ​系统​由​传感器、​DAQ​测量​硬件​和装​有​应用​软件​的​计算​机​组成。
sensor——DAQ Device——Computer

传感器:传感器​可​将​温度、​振动​等​物理​现象​转换​为​可​测量​的​电信​号,​比如​电压​或​电阻。
DAQ设备:DAQ​设备​可​将​输入​的​模拟​信号​数字​化​为​计算​机​可读​的​形式,​充当​计算​机​与​外界​信号​之间​的​接口。​DAQ​设备​包括​三​个​关键​组​件:
信号​调理​电路——​将​含​噪声​的​真实​信号​转换​为​能够​有效​而​准确​地​进行​测量​的​形式。
模数​转换​器​(ADC)——​将​真实​的​模拟​数据​数字​化​为​计算​机​可​处理​的​的​数字​表示​形式。
计算​机​总线——​使​DAQ​设备​能够​将​数据​传输​到​计算​机,​比如​USB、​PCIe​或​以太​网。
计算机及软件:需要​装​有​DAQ​软件​的​计算​机​才能​处理、​可​视​化​和​存储​测量​数据。 DAQ​软件​通常​包含​一个​驱动​程序,​可​通过​应用​软件​或​开发​环境​访问​该​驱动​程序。
驱动​软件——​使​应用​软件​能够​通过​基于​菜单​的​配置​或可​编​程​API​控制​DAQ​设备。
应用​软件——​使​用户​可以​立即​采集、​分析​和​展示​数据。​配置​通过​基于​菜单​的​界面​进行。
编​程​环境——​允许​用户​使用​功能​库​(API)​访问​和​控制​其​DAQ​设备,​以​自行​开发​应用​程序​来​采集、​分析​和​展示​数据。

QT新建项目——.pro文件
在这里插入图片描述
ui界面
在这里插入图片描述
组件选择:
1、放文本、放图片、放gif图的组件时qlabel;
2、qLineedit为一行文本输入框;
3、按钮是qpushbotton;
geometry设计窗口大小;
font里面设计字体大小;
alignment设计字体水平居中;

QT——信号和槽
1 给控件改名字
为了分析代码方便,我们要给控件改名字,要通俗易懂。

2 什么是信号和槽?
按钮的信号
信号:信号就是指控件发出的特定的信号。
槽:槽就是槽函数的意思,我们可以把槽函数绑定在某一个控件的信号上。
例如:当按钮触发信号,则信号就会激活槽函数。

3 怎么关联信号和槽?
(1)自动关联
手动选择相应的控件,然后右键转到槽。
自动关联会给我们的工程添加以下内容:
在这里插入图片描述
槽函数只能声明到private slots或public slots下面。声明槽函数在头文件里。
在这里插入图片描述
定义函数在widget.cpp文件里定义。

(2)手动关联
当访问界面的控件时,需要加上ui,因为此时的ui相当于指针,访问控件需要用“->”。
手动关联使用connect这个函数。
connect(ui->logonBt,SIGNAL(clicked()),this,SLOT(logonBt_clicked_slots()));
logonBt_clicked_slots()为槽函数;
connect(A,SIGNAL(B),C,SLOT(D));
解释:当对象A发出B信号时,就会触发对象C的槽函数D

给QT工程添加图片
第一步:添加图片资源文件。
第二步:引用这个图片。

界面布局
1、水平布局
2、垂直布局
3、栅格布局
撤销操作快捷键:ctrl + z

界面切换
步骤一:创建一个新的ui界面;
步骤二:利用控件、槽函数将其关联起来

仿写串口助手
步骤一:做好UI界面
接收框:plainTextEdit
步骤二:实现逻辑功能

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Usage: configure [-h] [-prefix <dir>] [-prefix-install] [-bindir <dir>] [-libdir <dir>] [-docdir <dir>] [-headerdir <dir>] [-plugindir <dir> ] [-importdir <dir>] [-datadir <dir>] [-translationdir <dir>] [-sysconfdir <dir>] [-examplesdir <dir>] [-demosdir <dir>] [-buildkey <key>] [-release] [-debug] [-debug-and-release] [-developer-build] [-shared] [-static] [-no-fast] [-fast] [-no-largefile] [-largefile] [-no-exceptions] [-exceptions] [-no-accessibility] [-accessibility] [-no-stl] [-stl] [-no-sql-<driver>] [-sql-<driver>] [-plugin-sql-<driver>] [-system-sqlite] [-no-qt3support] [-qt3support] [-platform] [-D <string>] [-I <string>] [-L <string>] [-help] [-qt-zlib] [-system-zlib] [-no-gif] [-no-libtiff] [-qt-libtiff] [-system-libtiff] [-no-libpng] [-qt-libpng] [-system-libpng] [-no-libmng] [-qt-libmng] [-system-libmng] [-no-libjpeg] [-qt-libjpeg] [-system-libjpeg] [-make <part>] [-nomake <part>] [-R <string>] [-l <string>] [-no-rpath] [-rpath] [-continue] [-verbose] [-v] [-silent] [-no-nis] [-nis] [-no-cups] [-cups] [-no-iconv] [-iconv] [-no-pch] [-pch] [-no-dbus] [-dbus] [-dbus-linked] [-no-gui] [-no-separate-debug-info] [-no-mmx] [-no-3dnow] [-no-sse] [-no-sse2] [-no-sse3] [-no-ssse3] [-no-sse4.1] [-no-sse4.2] [-no-avx] [-no-neon] [-qtnamespace <namespace>] [-qtlibinfix <infix>] [-separate-debug-info] [-armfpa] [-no-optimized-qmake] [-optimized-qmake] [-no-xmlpatterns] [-xmlpatterns] [-no-multimedia] [-multimedia] [-no-phonon] [-phonon] [-no-phonon-backend] [-phonon-backend] [-no-media-backend] [-media-backend] [-no-audio-backend] [-audio-backend] [-no-openssl] [-openssl] [-openssl-linked] [-no-gtkstyle] [-gtkstyle] [-no-svg] [-svg] [-no-webkit] [-webkit] [-webkit-debug] [-no-javascript-jit] [-javascript-jit] [-no-script] [-script] [-no-scripttools] [-scripttools] [-no-declarative] [-declarative] [-no-declarative-debug] [-declarative-debug] [additional platform specific options (see below)]
--------------------------- Qt Data Visualization 5.7.0 --------------------------- Qt Data Visualization module provides multiple graph types to visualize data in 3D space both with C++ and Qt Quick 2. System Requirements =================== - Qt 5.2.1 or newer - OpenGL 2.1 or newer (recommended) or OpenGL ES2 (reduced feature set) - Manipulating Qt Data Visualization graphs with QML Designer requires Qt Creator 3.3 or newer Building ======== Configure the project with qmake: qmake After running qmake, build the project with make: (Linux) make (Windows with MinGw) mingw32-make (Windows with Visual Studio) nmake (OS X) make The above generates the default makefiles for your configuration, which is typically the release build if you are using precompiled binary Qt distribution. To build both debug and release, or one specifically, use one of the following qmake lines instead. For debug builds: qmake CONFIG+=debug make or qmake CONFIG+=debug_and_release make debug For release builds: qmake CONFIG+=release make or qmake CONFIG+=debug_and_release make release For both builds (Windows/OS X only): qmake CONFIG+="debug_and_release build_all" make After building, install the module to your Qt directory: make install If you want to uninstall the module: make uninstall Building as a statically linked library ======================================= The same as above applies, you will just have to add static to the CONFIG: qmake CONFIG+=static Documentation ============= The documentation can be generated with: make docs The documentation is generated into the doc folder under the build folder. Both Qt Assistant (qtdatavisualization.qch) and in HTML format (qtdatavisualization subfolder) documentation is generated. Please refer to the generated documentation for more information: doc/qtdatavisualization/qtdatavisualization-index.html Known Issues ============ - Some platforms like Android and WinRT cannot handle multiple native windows properly, so only the Qt Quick 2 versions of graphs are available in practice for those platforms. - Shadows are not supported with OpenGL ES2 (including Angle builds in Windows). - Anti-aliasing doesn't work with OpenGL ES2 (including Angle builds in Windows). - QCustom3DVolume items are not supported with OpenGL ES2 (including Angle builds in Windows). - Surfaces with non-straight rows and columns do not always render properly. - Q3DLight class (and Light3D QML item) are currently not usable for anything. - Changing most of Q3DScene properties affecting subviewports currently has no effect. - Widget based examples layout incorrectly in iOS. - Reparenting a graph to an item in another QQuickWindow is not supported. - Android builds of QML applications importing QtDataVisualization also require "QT += datavisualization" in the pro file. This is because Qt Data Visualization QML plugin has a dependency to Qt Data Visualization C++ library, which Qt Creator doesn't automatically add to the deployment package. - Only OpenGL ES2 emulation is available for software renderer (that is, when using QCoreApplication::setAttribute(Qt::AA_UseSoftwareOpenGL))

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值