day4 QT

作业

cpp 复制代码
#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
    , speech(new QTextToSpeech)
{
    ui->setupUi(this);
    id = startTimer(1000);
}

Widget::~Widget()
{
    delete ui;
}

void Widget::timerEvent(QTimerEvent *e)
{
    if(e->timerId() == id)
    {
        QTime time = QTime::currentTime();
        ui->label->setText(time.toString("hh:mm:ss"));
        if(time.toString("hh:mm:ss") == my_time)
        {
            for(int i=0;i<5;i++)
            {
                speech->say(ui->label_3->text());
            }
        }
    }

}


void Widget::on_pushButton_clicked()
{
    my_time = ui->lineEdit->text();
    
    
    ui->label_5->setText(ui->lineEdit->text());
    ui->lineEdit->clear();
}
相关推荐
小糖学代码5 小时前
LLM系列:1.python入门:15.JSON 数据处理与操作
开发语言·python·json·aigc
handler015 小时前
从源码到二进制:深度拆解 Linux 下 C 程序的编译与链接全流程
linux·c语言·开发语言·c++·笔记·学习
小白学大数据5 小时前
现代Python爬虫开发范式:基于Asyncio的高可用架构实战
开发语言·爬虫·python·架构
渔舟小调5 小时前
P19 | 前端加密通信层 pikachuNetwork.js 完整实现
开发语言·前端·javascript
不爱吃炸鸡柳5 小时前
数据结构精讲:树 → 二叉树 → 堆 从入门到实战
开发语言·数据结构
网络安全许木5 小时前
自学渗透测试第21天(基础命令复盘与DVWA熟悉)
开发语言·网络安全·渗透测试·php
t***5445 小时前
如何在Dev-C++中使用Clang编译器
开发语言·c++
码界筑梦坊6 小时前
93-基于Python的中药药材数据可视化分析系统
开发语言·python·信息可视化
Cosmoshhhyyy7 小时前
《Effective Java》解读第49条:检查参数的有效性
java·开发语言
棋子入局7 小时前
C语言制作消消乐游戏(2)
c语言·开发语言·游戏