A Short Course on QT
A cross-platform application framework
Download QT
Installation
1. Run the qt installer you’ve just downloaded.
2. Sign up to acquire a QT account.
3. Accept the license.
Installation
4. Specify installation folder.
5. Select QT 6.x desktop development.
6. Proceed with installation.
Project
Step 1 Create a Qt Project using the wizard.
Project
Select Qt Widgets Application. Step 2
Specify project name and location.
Project
Step 3
Avoid using folder names with a space character (or any foreign characters).
Define the build system
Project
Step 4
Select qmake as the build system.
Use the default base class.
Project
Step 5
Project
Optionally, specify a translation language
Select a Kit
Project
Step 6
Select Manage button to customise the Kit for your project.
Select MinGW 64-bit kit
Project
Step 7
Click the MinGW 64-bit kit
Qt versions
Project
Step 8
Under QT versions, select the latest version (e.g. Qt 6.5.1)
Compilers
Project
Step 9
Under Compilers tab, select MinGW for C++ and C. You may remove the other existing
compilers for the project (if there are any) as we don’t need them.
Debuggers
Project
Step 10
Under Debuggers, we will use the one that comes with MinGW. Click Apply, then OK buttons.
Project
Click Next to proceed.
Project
Click Finish.
Project
Files comprising the start-up codes.
This is the Edit view
Project
Build directory.
A build directory is automatically created for the LetterRecognition project.
Select Form, mainwindow.ui
Project
Step 11
Design view
Project
Step 12
Add a horizontal layout
Project
Step 13
Add a label
Project
Step 14
Project
Step 15
horizontalSlider_maxEpochs
Property value
Widgets
Add a horizontal slider.
Add an LCD number.
Project
Step 16
horizontalSlider_maxEpochs
lcdNumber_maxEpochs
Widgets
Property value
Project
Step 17 Switch to Edit mode, then add a new header file to the project.
Project
Switch to Edit mode, then add a header file to the
project.
Click next, then finish.
Switch to globalVariables.h, then add an external
variable declaration.
Project
Step 18
#ifndef GLOBALVARIABLES_H
#define GLOBALVARIABLES_H
extern int maxEpochs;
#endif // GLOBALVARIABLES_H
Switch to Design view by clicking main.cpp
Project
Step 19
#include <QApplication>
#include "mainwindow.h"
int maxEpochs;
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}
Associate a function with the horizontal slider by
right-clicking it, then selecting Go to slot, then
the valueChanged() function.
Project
Step 20
#include "mainwindow.h"
#include "ui_mainwindow.h"
////////////////////////////////////////
#include "globalVariables.h“
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_horizontalSlider_maxEpochs_valueChanged(int value)
{
ui->lcdNumber_maxEpochs->setSegmentStyle(QLCDNumber::Filled);
ui->lcdNumber_maxEpochs->display(value);
maxEpochs = value;
}
Write the implementation for the valueChanged()
signal.
Project
Step 21
We now have an interface for the maxEpochs
global variable.
Project
Step 22
Add an LCD for displaying a calculated floating
point value.
Project
Step 1
lcdNumber_result
Improves readability
Add a pushButton.
Project
Step 2
pushButton_Calculate
Right-click the pushButton, then
select Go to slot to assign a
function to it’s clicked() signal.
Write the implementation for the clicked() signal,
inside mainwindow.cpp.
Project
Step 3
void MainWindow::on_horizontalScrollBar_valueChanged(int value)
{
ui->lcdNumber_maxEpochs->setSegmentStyle(QLCDNumber::Filled);
ui->lcdNumber_maxEpochs->display(value);
maxEpochs = value;
}
void MainWindow::on_pushButton_Calculate_clicked()
{
float result=0.0;
result = maxEpochs * 2.2; //some hypothetical formula
ui->lcdNumber_result->display(result);
update();
QCoreApplication::processEvents();
}
Sample run.
Project
Step 4
pushButton_Calculate
Performs a simple calculation:
30 * 2.2
Project
Mouse cursor How to change the mouse cursor to indicate busy
calculation activity.
Add the following header first, in order to access
the mouse cursor methods:
#include <QApplication>
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
//perform lengthy operations here…
QApplication::restoreOverrideCursor();
Add more widgets
Project
Step 5
pushButton
plainTextEdit_results
How to update the gui’s display while running a
loop?
Project
Widget’s
display
contents By calling processEvents(), the display of the
widget named ui->plainTextEdit_results will be
updated for each iteration.
By calling processEvents(), the display of the
widget named ui->plainTextEdit_results will be
updated for each iteration.
void MainWindow::on_pushButton_clicked()
{
QString msg;
for(int i=1; i < maxEpochs; i++){
msg.clear();
msg.append("Epoch = ");
msg.append(QString::number(i));
ui->plainTextEdit_results->setPlainText(msg);
QCoreApplication::processEvents(); // qApp->processEvents();
QThread::msleep(50); //delay of 50 msec.
}
}
void MainWindow::on_pushButton_clicked()
{
QString msg;
for(int i=1; i < maxEpochs; i++){
msg.clear();
msg.append("Epoch = ");
msg.append(QString::number(i));
ui->plainTextEdit_results->setPlainText(msg);
QCoreApplication::processEvents(); // qApp->processEvents();
QThread::msleep(50); //delay of 50 msec.
}
}
Example:
requires requires #include <QThread> #include <QThread>
Assignment #2
Letter Recognition using Deep Neural
Nets with Softmax Units
Learning Objective: Implement backpropagation
learning algorithm for a deep network classifier system.
Consider different weight-update formula variations,
hyperparameter settings, optimization strategies to get the
best network configuration. Apply modern training
techniques.
Letter Recognition Problem
UCI’s Machine Learning Repository
Classification Task: Identify
each of a large number of black and-white rectangular pixel
displays as one of the 26 capital
letters in the English alphabet.
Source: character images based
on 20 different commercial
fonts and each letter within
these 20 fonts was randomly
distorted to produce a file of
20,000 unique stimuli.
http://archive.ics.uci.edu/ml/datasets/Letter+Recognition
Data Set
History:
P. W. Frey and D. J. Slate (Machine Learning Vol 6 #2 March 91):
"Letter Recognition Using Holland-style Adaptive Classifiers".
The best accuracy obtained was a little over 80%
Challenge: Using modern deep network training techniques, we would
like to find out what is the best accuracy we can obtain.
DATA SET:
Number of Instances: 20,000
Missing Attribute Values: None
INPUTS:
16 primitive numerical attributes (statistical moments and edge
counts)
UCI’s Machine Learning Repository
http://archive.ics.uci.edu/ml/datasets/Letter+Recognition
Data Set
INPUTS:
16 primitive numerical attributes (statistical moments and edge counts)
UCI’s Machine Learning Repository
Hand-crafted Input Features
INPUTS:
16 primitive numerical attributes (statistical
moments and edge counts)
UCI’s Machine Learning Repository
http://archive.ics.uci.edu/ml/datasets/Letter+Recognition
The attributes (before scaling to 0-15 range) are:
1. The horizontal position, counting pixels from the left edge of the image, of the center
of the smallest rectangular box that can be drawn with all "on" pixels inside the box.
2. The vertical position, counting pixels from the bottom, of the above box.
3. The width, in pixels, of the box.
4. The height, in pixels, of the box.
5. The total number of "on" pixels in the character image.
6. The mean horizontal position of all "on" pixels relative to the center of the box and
divided by the width of the box. This feature has a negative value if the image is "leftheavy"
as would be the case for the letter L.
7. The mean vertical position of all "on" pixels relative to the center of the box and divided
by the height of the box.
Hand-crafted Input Features
UCI’s Machine Learning Repository
8. The mean squared value of the horizontal pixel distances as measured in 6 above. This attribute will
have a higher value for images whose pixels are more widely separated in the horizontal direction as
would be the case for the letters W or M.
9. The mean squared value of the vertical pixel distances as measured in 7 above.
10. The mean product of the horizontal and vertical distances for each "on" pixel as measured in 6 and 7
above. This attribute has a positive value for diagonal lines that run from bottom left to top right and a
negative value for diagonal lines from top left to bottom right.
11. The mean value of the squared horizontal distance times the vertical distance for each "on" pixel.
This measures the correlation of the horizontal variance with the vertical position.
12. The mean value of the squared vertical distance times the horizontal distance for each "on" pixel.
This measures the correlation of the vertical variance with the horizontal position.
13. The mean number of edges (an "on" pixel immediately to the right of either an "off“ pixel or the
image boundary) encountered when making systematic scans from left to right at all vertical positions
within the box. This measure distinguishes between letters like "W" or "M" and letters like 'T' or "L."
14. The sum of the vertical positions of edges encountered as measured in 13 above. This feature will
give a higher value if there are more edges at the top of the box, as in the letter "Y.“
15. The mean number of edges (an "on" pixel immediately above either an "off" pixel or the image
boundary) encountered when making systematic scans of the image from bottom to top over all
horizontal positions within the box.
16. The sum of horizontal positions of edges encountered as measured in 15 above. http://archive.ics.uci.edu/ml/datasets/Letter+Recognition
Hand-crafted Input Features
INPUTS:
16 primitive numerical attributes (statistical moments and edge counts)
scaled to fit into a range of integer values from 0 through 15.
1. lettr capital letter (26 values from A to Z)
2. x-box horizontal position of box (integer)
3. y-box vertical position of box (integer)
4. width width of box (integer)
5. high height of box (integer)
6. onpix total # on pixels (integer)
7. x-bar mean x of on pixels in box (integer)
8. y-bar mean y of on pixels in box (integer)
9. x2bar mean x variance (integer)
10. y2bar mean y variance (integer)
11. xybar mean x y correlation (integer)
12. x2ybr mean of x * x * y (integer)
13. xy2br mean of x * y * y (integer)
14. x-ege mean edge count left to right (integer)
15. xegvy correlation of x-ege with y (integer)
16. y-ege mean edge count bottom to top (integer)
17. yegvx correlation of y-ege with x (integer)
UCI’s Machine Learning Repository
http://archive.ics.uci.edu/ml/datasets/Letter+Recognition
Letter Recognition Data Set
INPUTS:
16 primitive numerical attributes (statistical moments and edge
counts)
scaled to fit into a range of integer values from 0 through 15.
TRAINING and TEST SET:
We typically train on the first 16,000 items and then use the
resulting model to predict the letter category for the remaining
4,000. See the article cited for more details.
UCI’s Machine Learning Repository
http://archive.ics.uci.edu/ml/datasets/Letter+Recognition
Note: We can normalize the inputs (e.g. between [0 to 1]), before feeding them
to the network.
Note: We can normalize the inputs (e.g. between [0 to 1]), before feeding them
to the network.
NN architecture
use Softmax
units
At the output
layer
Minimum of 2 hidden layers
Dataset: Dataset: complete_data_set.txt complete_data_set.txt
Build folder
Copy the dataset into the build folder to make it
accessible to the program.
Read the dataset contained in
complete_data_set.txt
Load the saved weights
contained in weights.txt
Save the weights resulting from
training. Filename: weights.txt
Max Epochs (may use either
a slider or a spinner widget)
Learning rate (may use either a
slider or a spinner widget)
Train the network using iterative
minimization of error
Randomly initialize the weights
of the network.
As we have learned, shuffling the
training data is important so we
have a data shuffling button
here.
L2 regularization
SSE on Training data Percentage of Good
Classification on Training data
Percentage of Good
Classification on Training data
SSE on Test data Percentage of Good
Classification on Test data
Percentage of Good
Classification on Test data
Single input data pattern
Classification result
Test the input data using the
network
What should I set to compile a Qt program after
moving it to another directory?
1. Firstly, delete any file with the extension .pro.user, as they are
created specific to the user’s directory structure, and must be
regenerated after moving a project to another folder.
• e.g. LetterRecognition.pro.user
2. When you are in Qt creator you should rerun qmake. Go to the
left pane where you typically find "Projects" otherwise select
projects. Go to the project name and do a right click, select
"Run qmake".
3. It’s important to note that a path name (very deep directory
structure) that is very long could cause some problems. Simply
reduce the name or move the folder closer to the root dir.
相关推荐
dotnet演进史:从Framework到.NET 8的兼容与选型指南
在技术快速迭代的背景下,框架版本的演进与兼容性成为企业技术决策的关键因素。.NET作为主流开发平台,经历了从.NET Framework到.NET Core再到统一.NET 5/6/8的复杂变迁,版本间的断档与迁移成本常让开发者和产品团队困扰。.NET Standard的出现为类库跨框架复用提供了统一契约,而多目标构建则让老项目平滑过渡成为可能。理解版本映射、兼容矩阵和LTS/STS节奏,不仅能指导技术选型,还能帮助企业制定合理的迁移路线。在工程实践中,将演进历史与决策逻辑转化为可视化内容(如PPT),更是
OpenHarmony 编译报错 ‘xxx‘ can‘t support crossplatform application
'xxx' can't support crossplatform application
【COMSOL】将一个面上数据导出CSV或txt格式的方法
在COMSOL中参数化扫描后,把一个面上或体里的数据按照CSV或TXT格式导出的方法。
【HarmonyOS 5】 ArkUI-X开发中的常见问题及解决方案
:遮罩层无法覆盖原生控件,或自定义浮层内容频繁重建导致性能下降。:自定义弹窗中的焦点切换失效,或页面跳转后焦点残留。:动效环节超过0帧丢帧,加载环节超过6帧丢帧。:页面元素错位、资源加载失败或主题样式失效。模块时预览白屏,或跨平台编译后功能异常。等鸿蒙专属API时,编译跨平台工程报错。:修改了平台相关代码或原生模块。:使用Router模块的。
基于 YOLO + SAM 的自动图像标注实战
摘要: 本文提出一种基于YOLO检测和SAM分割的自动化数据标注流水线方案,通过YOLO定位目标并生成检测框,再以检测框为提示驱动SAM完成精细分割,最终输出YOLO格式的标注文件。该方案将人工标注升级为半自动流程,显著提升标注效率,尤其适用于多类别、大规模图像的实例级标注需求。代码模块化设计支持模型灵活替换,并集成异常处理与进度可视化功能。虽依赖YOLO检测质量且对小目标存在局限,但作为工程落地方案,可有效降低私有数据集构建成本,适用于工业检测、遥感等场景的冷启动标注。
解决fetch_california_housing数据集403错误的3种实用方法(附手动下载地址)
本文针对机器学习中常见的fetch_california_housing数据集403 Forbidden错误,提供了三种实用的解决方案。从理解HTTP 403错误的根源出发,详细介绍了修改源码路径、使用国内镜像源以及手动下载并配置数据文件这三种方法,并附带了可靠的手动下载地址,帮助开发者彻底解决数据加载障碍,确保机器学习项目顺利进行。
华为ArkUI-X 开发避坑指南 一 善用//@ts-ignore
或者,使用//@ts-nocheck禁用整个文件的类型检查。不过,你要小心整个文件没有类型检查,排查错误的坑会一个接一个。这不是一个普通注释,这是专门用来规避一些仅能在harmonyOS平台运行的代码。当你在构建中报错提示:can't support crossplatform application.欢迎入坑ArkUI-X项目,一套代码跨平台开发的梦乡。但是,要注意一些因为你写法习惯造成的困扰。只要报错的地方,都加上//@ts-ignore。直接使用//@ts-ignore即可。
交通小白首投TRB就中Oral?我的完整时间线与避坑指南(附Editorial Manager实操截图)
本文详细解析了交通领域新手如何高效完成TRB国际会议投稿的全流程,从选题策略到投稿系统实操,再到评审过程解析和常见误区避坑指南。特别针对初次投稿者提供了实用建议,包括时间规划、选题考量、Editorial Manager系统操作技巧,以及如何应对评审意见。文章还分享了从录用到会议参与的关键步骤,帮助研究者提升投稿成功率。
OpenHarmony开发板无法运行端云一体化项目的解决方案【坚果派-咸鱼】
OpenHarmony开发板运行端云一体化项目出现“Error while Deploy Hap”错误的解决方案
告别环境报错:用Pycharm一站式搞定Superset 3.0.0二次开发环境(Windows/Mac通用)
本文详细介绍了如何使用Pycharm一站式搭建Apache Superset 3.0.0的二次开发环境,涵盖Windows和Mac平台。通过虚拟环境配置、依赖管理、数据库初始化及前后端协同开发等步骤,帮助开发者高效解决环境报错问题,提升开发效率。特别适合需要进行Superset二次开发的工程师参考。
cadence Virtuoso ADE原理图库中的VCVS(压控电压源)使用
Symbol: vcvs (Voltage Controlled Voltage Source) Vop−Von=egain⋅(Vip−Vin)V_{op}-V_{on}=egain\cdot(V_{ip}-V_{in})Vop−Von=egain⋅(Vip−Vin) 所以可以得出 ⟹Vop=egain⋅(Vip−Vin)+Von\Longrightarrow V_{op}=egain\cdot(V_{ip}-V_{in})+V_{on}⟹Vop=egain⋅(Vip−Vin)+Von 使
应用启动框架AppStartup应用场景分析
OpenClaw更新后变傻了?一分钟教你快速恢复(OpenClaw更新版本后降智、缺少权限问题的解决方案)
OpenClaw 版本更新后出现降智问题,AI不再执行具体任务。本文详细分析问题原因,提供最简便的解决方案✅
【论文阅读】A Case Study on Cross-Platform Development Frameworks for Mobile Applications and UX
移动应用程序的跨平台开发框架在降低成本和简化维护方面具有显著优势,为需要为多个平台设计移动应用的组织提供了极具吸引力的选择。鉴于平台规范对移动应用用户体验(UX)尤为重要,使用同一套代码定义不同平台应用行为的框架可能对UX产生负面影响。本文描述了一项研究:两个独立团队分别使用跨平台框架(自动生成Android和iOS版本)和原生工具开发了同一款移动应用的不同版本。通过实验室可用性测试与纵向研究相结合的方式,由37名用户对两个平台的不同版本进行评估。结果显示,在Android平台上差异较小;
全局注意机制 GAM | Global Attention Mechanism: Retain Information to Enhance Channel-Spatial Interactions
全局注意机制 GAM
大中型超市收银系统(可直接运行)
光步前台收银系统系统功能:商品销售、商品退货、挂单、收银员权限、会员销售、单品取消、整单取消、商品查询、脱机销售、脱机数据上传,基本资料下载,开钱箱、小票打印、收款结算,支持多币种付款方式(现金、储值卡、礼券、微信等),支持多种促销。运行环境:.net 4.0登陆信息用户名:1001 密码:123456内置商品信息,商品编码可输入00001000 - 00010000,测试效果相关功能键F5 结算 F9挂单 F11商品查询 F8退货 Insert单品取消 Del整单取消 F12开钱箱F2 会员 Ctrl+Z退出系统 Home 锁屏 相关源码待公开
Download Qt, the cross-platform application framework
Here is the latest version of the Qt 5.0 Beta 2 packages. The edition you download here must match the OS you have your development system on. The source code is available as a zip (261 MB) or a
IEM模型,地表粗糙度模拟
利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟
go qt linux,goqt: Golang bindings to the Qt cross-platform application framework.
GoQtIntroductionGoQt is golang bindings to the Qt cross-platform application framework.Version: 0.1.2ExperimentGoQt project current is experiment.What is GoQtGoQt is a GUI toolkit for the Go programmi...
win10 跳过U8环境检测的IE WebControls.rar
win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。
LinePhone3.2.7(android端最新版本) sip客户端
SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/
学习008-01-01 Create a Cross-Platform .NET App UI Application(创建一个跨平台的.NET 应用程序用户界面应用程序)
创建新应用程序时,应用程序向导会尝试查找已安装的MicrosoftSQLServer实例(LocalDB或Express)并相应地设置连接字符串。要运行Windows窗体应用程序,请右键单击解决方案资源管理器中的SimpleProjectManager.Win项目,然后在上下文菜单中选择设置为启动项目选项。一个ASP.NETCore Blazor应用程序,它根据您在SimpleProjectManager模块中定义的数据模型生成用户交互界面。在此页面上,您可以选择要添加到应用程序的即用型XAF模块。
VCF的开发环境搭建
VCF的开发环境搭建一、VCF是什么?已经有几篇文章详细介绍了,这里我就不重复了,详细内容请了解linkman网友的关于VCF(Visual Component Framework),关于VCF的RTII机制的分析VCF的RTII机制,另外有官方的网站www.vcf-online.org 二、为什么选择VCF?VCF是一个Cross-plat
Ionic Framework v5 完整版本解析:从 Magnesium 到 5.9.x 的演进、破坏性变更与升级实战指南
Ionic Framework 的 v5 主版本(代号 Magnesium)是 2020 年至 2021 年间承载 Angular 9、React Router 6、Vue 3 等主流前端生态的关键一代。本文基于仓库中的 [CHANGELOG_ARCHIVE/v5.md](https://link.gitcode.com/i/d038a885b72b2640b4400d9cfea8b1b8) 与
Theos跨平台构建系统终极指南:一站式开发iOS、macOS、Linux和Windows应用
Theos是一款功能强大的跨平台构建系统,专为创建iOS、macOS、Linux和Windows程序而设计。无论您是移动应用开发者、桌面软件工程师,还是跨平台解决方案架构师,Theos都能提供统一的开发体验,彻底解决多平台构建的复杂性挑战。 ## 🎯 为什么选择Theos构建系统? ### 跨平台统一开发体验 Theos最大的优势在于其统一的构建系统架构。通过精心设计的模块化makefil
Lime框架架构解析:理解其模块化设计与扩展机制
Lime框架是一个轻量级的跨平台开发框架,为Haxe开发者提供了统一的多平台支持。作为OpenFL项目的基础层,Lime采用**模块化架构设计**,让开发者能够轻松构建跨桌面、移动和Web平台的应用程序。本文将深入解析Lime的架构设计原理,帮助您理解其模块化结构与扩展机制。🚀 ## Lime框架概述:跨平台开发的基石 Lime是一个灵活的、轻量级的Haxe跨平台开发层,支持原生、Flash
.NET 面试核心题精讲:.NET Framework、.NET Core 与 ASP.NET Core 全解析(FAQGURU 技术指南)
本篇技术指南以 FAQGURU 开源面试题库中的 [.NET Framework 主题文档](https://link.gitcode.com/i/67bad36d9742b659b6599dc9867c2989) 为主体,系统梳理了从 .NET Framework 到 .NET Core、ASP.NET Core 的完整知识脉络:运行时(CLR/CoreCLR)、编译模型(MSIL、JIT、Ry
ASP.NET Core OpenID Connect 示例实战:在 OpenIdConnectSample 中配置 Azure AD 与 Google 身份提供方
本指南以 aspnetcore 仓库中的 [OpenIdConnectSample 示例文档](https://link.gitcode.com/i/c4debcf5f606993fa4e9b0a0efdccbd0) 为核心,完整讲解如何在本地把该示例跑起来,并分别用 Azure Active Directory 与 Google Identity Platform 作为 OpenID Conne
终极指南:如何让NotepadNext在Windows 7上流畅运行
还在为NotepadNext在Windows 7系统上无法正常启动而烦恼吗?作为Notepad++的跨平台重实现,NotepadNext确实在Windows 7上可能会遇到一些兼容性挑战。别担心,这篇完整指南将带你一步步解决所有问题,让你的Windows 7系统也能享受这款强大的文本编辑器!🚀 NotepadNext是一款基于Qt框架开发的跨平台文本编辑器,它继承了Notepad++的核心功能
Valdi 的 Bazel 构建体系:规则、命令与跨平台构建实战指南
Valdi 是一个跨平台 UI 框架,其整个工程(编译器、运行时、示例应用与测试)统一由 Bazel 驱动,以保证在 iOS、Android、macOS、Linux 与 Web 等多个目标平台上获得可复现、可增量、确定性的构建。本文以仓库中 [ai-skills/skills/valdi-bazel/skill.md](https://link.gitcode.com/i/6ebeedec1b57
422



被折叠的 条评论
为什么被折叠?



