当前位置:网站首页>QT开发简介、命名规范、signal&slot信号槽
QT开发简介、命名规范、signal&slot信号槽
2022-07-30 21:48:00 【Lee Neo】
QT学习资料:
正点原子B站视频;
正点原子QT开发指南;
学习计划:
看视频,和开发指南,在cadn上记笔记,最终在开发板实现一个音乐播放器小项目;
命名规范:
信号槽:
mainwindow.cpp程序:
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
this->resize(800,480);
//实例化pushButton对象;
pushButton = new QPushButton(this);
//调用settext方法 设定按钮的文本;
pushButton ->setText("我是一个按钮");
//信号和槽连接;
connect(pushButton,SIGNAL(clicked()),this,SLOT(pushButtonClick()));
connect(this,SIGNAL(pushButtonTextChange()),this,SLOT(changeButtonText()));
}
MainWindow::~MainWindow()
{
}
//实现按钮点击槽函数;
void MainWindow :: pushButtonClick()
{
emit pushButtonTextChange();
}
void MainWindow::changeButtonText()
{
pushButton->setText("被点击了");
QThread::sleep(3);
pushButton->setText("点击");/这里不会显示“被点击了”,可能槽函数的执行不会即使反映到界面??
}
结果不会显示“被点击了”,可能槽函数的执行不会及时反映到界面??
边栏推荐
- 基于ABP实现DDD--实体创建和更新
- Teach you how to build a permanently running personal server
- IDEA 连接 数据库
- LeetCode·Daily Question·952. Calculate Maximum Component Size by Common Factor·Union Check
- 系统结构考点之CRAY-1向量处理机
- Niu Ke Xiaobaiyue Race 53 A-E
- MySQL 5.7 detailed download, installation and configuration tutorial
- 基于ABP实现DDD--领域逻辑和应用逻辑
- Navicat new database
- The most complete Redis basic + advanced project combat summary notes in history
猜你喜欢
类和对象——上
A simple rich text editor
About the data synchronization delay of MySQL master-slave replication
MySQL 5.7 detailed download, installation and configuration tutorial
When Navicat connects to MySQL, it pops up: 1045: Access denied for user 'root'@'localhost'
Detailed explanation of the delete problem of ClickHouse delete data
史上最全的Redis基础+进阶项目实战总结笔记
MySQL Soul 16 Questions, How Many Questions Can You Last?
WSL安装图形界面并通过xrdp/X-Launch访问
【导航规划】导航规划背景知识总结
随机推荐
WinDbg实践--入门篇
navicat连接MySQL报错:1045 - Access denied for user ‘root‘@‘localhost‘ (using password YES)
WSL安装图形界面并通过xrdp/X-Launch访问
MySQL 8.0.29 set and modify the default password
navicat新建数据库
系统结构考点之并行计算霍纳法则
MySQL 5.7详细下载安装配置教程
基于ABP实现DDD--实体创建和更新
ClickHouse 数据插入、更新与删除操作 SQL
【问题】Mysql Waiting for table metadata lock 解决方案 修改lock_wait_timeout时间
系统结构考点之PM2I单级网络
MySQL 8.0.29 decompressed version installation tutorial (valid for personal testing)
LeetCode·每日一题·952.按公因数计算最大组件大小·并查集
Day 16 of HCIP
系统结构考点之流水线向量点积
openim支持十万超级大群
你需要知道的ES6—ES13开发技巧
MySQL压缩包方式安装,傻瓜式教学
TransGAN code reproduction - Jiutian Bisheng Platform
史上超强最常用SQL语句大全