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();
}
相关推荐
小小测试开发11 小时前
安装 Python 3.10+
开发语言·人工智能·python
AAA大运重卡何师傅(专跑国道)13 小时前
【无标题】
开发语言·c#
XBodhi.13 小时前
Visual Studio C++ 语法错误: 缺少“;”(在“return”的前面)
开发语言·c++·visual studio
LSssT.14 小时前
【01】Python 机器学习
开发语言·python
l1t14 小时前
DeepSeek总结的使用实体-组件-系统和基于存在性处理进行Python编程39-40
开发语言·python
曾阿伦14 小时前
Python 搭建简易HTTP服务
开发语言·python·http
YG亲测源码屋14 小时前
java配置环境变量、jdk环境变量配置、java环境变量设置方法
java·开发语言
MIUMIUKK15 小时前
从语法层面,看懂 Python 的特殊处
java·开发语言·python
FlyWIHTSKY15 小时前
TS、TSX、JS、JSX 文件扩展名详解
开发语言·javascript·ecmascript
着迷不白15 小时前
第一部分:认识python
开发语言·python