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();
}
相关推荐
俊俊谢4 分钟前
[python]FastAPI + 自建SSE 踩坑全记录
开发语言·python·fastapi
大智兄6 分钟前
128.配置qt(交叉)编译的路径---解决无法编译的问题
qt
qydz1123 分钟前
杰理开发板做TWS耳机类型方案分享(1)
开发语言·pcb工艺·嵌入式开发·杰理科技
Cloud_Shy6181 小时前
解读《Effective Python 3rd Edition》:从练气到老魔(第六章 Item 40 - 43)
android·开发语言·人工智能·笔记·python·学习方法
半只小闲鱼1 小时前
配置计划模块通用办公设备家具批复数合计计算
开发语言·python
qq_422152571 小时前
Word 文件太大怎么压缩?2026 年文档瘦身方案对比
开发语言·c#·word
charliedev1 小时前
Jedi:Python 自动补全与静态分析的实用工具
开发语言·python·其他
ji198594432 小时前
MATLAB 求散点曲线斜率
开发语言·算法·matlab
kaikaile19952 小时前
MATLAB 实现:Koch & Zhao 图像水印算法(DCT域)
开发语言·算法·matlab
love_muming2 小时前
链表每日一练
java·开发语言·数据结构·链表·idea·每日一练