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();
}
相关推荐
无限的鲜花2 小时前
反射(原创推荐)
java·开发语言
yongche_shi2 小时前
ragas官方文档中文版(五十)
开发语言·python·ai·ragas·如何评估和改进 rag 应用
一路向北he3 小时前
字节钢铁军团--“提供情境,而非控制”
java·开发语言·前端
AI行业学习4 小时前
Notepad++ 官方下载 + 完整安装 + 全套优化配置(2026最新)
开发语言·人工智能·python·前端框架·html·notepad++
大圣编程5 小时前
Python中continue语句的用法是什么?
开发语言·前端·python
upgrador5 小时前
基础知识:C++ STL构造函数的左闭右开惯例及其实现原理
开发语言·c++
yoothey6 小时前
报废审批流规则引擎设计——责任链模式完整实现
linux·开发语言·bash
尘中远6 小时前
【Qwt 7.0 系列】坐标轴与刻度系统 —— 刻度引擎、网格、图例与刻度朝内
qt·数据可视化·qcustomplot·qwt·工业软件·科学绘图
geovindu6 小时前
python: Functional Options Pattern
开发语言·后端·python·设计模式·惯用法模式·函数式选项模式
wuyk5556 小时前
24. C 语言模块化:不是拆几个.c 文件那么简单
c语言·开发语言·stm32·单片机