当前位置:网站首页>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("点击");/这里不会显示“被点击了”,可能槽函数的执行不会即使反映到界面??
}
结果不会显示“被点击了”,可能槽函数的执行不会及时反映到界面??
边栏推荐
猜你喜欢

MYSQL JDBC图书管理系统

Niu Ke Xiaobaiyue Race 53 A-E

不用bs4的原因居然是名字太长?爬取彩票开奖信息

基于ABP实现DDD--领域服务、应用服务和DTO实践

系统结构考点之CRAY-1向量处理机

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

NEOVIM下载安装与配置

OpenCV笔记(二十):滤波函数——filter2D

Solve the problem of centos8 MySQL password ERROR 1820 (HY000) You must reset your password using the ALTER USER

MySQL compressed package installation, fool teaching
随机推荐
How do I refresh the company's background management system (Part 1) - performance optimization
openim支持十万超级大群
【微信小程序】小程序突破小程序二维码数量限制
数据质量提升
Navicat连接MySQL时弹出:1045:Access denied for user ‘root’@’localhost’
Installation and use of cnpm
MySql 5.7.38下载安装教程 ,并实现在Navicat操作MySql
MySQL 8.0.29 decompressed version installation tutorial (valid for personal testing)
走进Redis,让你重新认识redis。绝不是表面
mysql创建表
for...in 和 for...of 的区别
使用LVS和Keepalived搭建高可用负载均衡服务器集群
Detailed explanation of the delete problem of ClickHouse delete data
LeetCode · 23. Merge K ascending linked lists · recursion · iteration
Solve npm warn config global `--global`, `--local` are deprecated. use `--location=global` instead
你需要知道的ES6—ES13开发技巧
qt使用动态库(DLL)
MySQL删除表数据 MySQL清空表命令 3种方法
ClickHouse to create a database to create a table view dictionary SQL
C语言犄角旮旯的知识之结构体