当前位置:网站首页>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("点击");/这里不会显示“被点击了”,可能槽函数的执行不会即使反映到界面??
}
结果不会显示“被点击了”,可能槽函数的执行不会及时反映到界面??
边栏推荐
- Navicat connection MySQL error: 1045 - Access denied for user 'root'@'localhost' (using password YES)
- The structure of knowledge in the corners of the C language
- TransGAN代码复现—九天毕昇平台
- 【科研】文献下载神器方式汇总
- Automatically generate test modules using JUnit4 and JUnitGenerator V2.0 in IDEA
- cnpm的安装与使用
- Google Earth Engine ——
- 数据质量提升
- Navicat连接MySQL时弹出:1045:Access denied for user ‘root’@’localhost’
- 【网络安全专栏目录】--企鹅专栏导航
猜你喜欢

基于ABP实现DDD--仓储实践

Google Earth Engine ——ee.List.sequence函数的使用

cookie和session区别

MySQL压缩包方式安装,傻瓜式教学

Teach you how to build a permanently running personal server

mysql 时间字段默认设置为当前时间

openim支持十万超级大群

Automatically generate test modules using JUnit4 and JUnitGenerator V2.0 in IDEA

解决centos8 MySQL密码问题ERROR 1820 (HY000) You must reset your password using ALTER USER

Day 16 of HCIP
随机推荐
mysql 时间字段默认设置为当前时间
折叠旧版应用程序
cookie和session区别
The most complete Redis basic + advanced project combat summary notes in history
系统结构考点之并行主存
MySQL 8.0.29 set and modify the default password
Collapse legacy apps
NEOVIM下载安装与配置
MySQL删除表数据 MySQL清空表命令 3种方法
3分钟带你了解微信小程序开发
JS中获取元素属性的8大方法
设备树的引入与体验
【Nacos】解决Nacos下载速度缓慢的问题
鳄梨价格数据集(Avocado Prices)
The mysql time field is set to the current time by default
cmd (command line) to operate or connect to the mysql database, and to create databases and tables
解决centos8 MySQL密码问题ERROR 1820 (HY000) You must reset your password using ALTER USER
代码越写越乱?那是因为你没用责任链
The Road to Ad Monetization for Uni-app Mini Program Apps: Rewarded Video Ads
ClickHouse 创建数据库建表视图字典 SQL