10.20作业

编程入门 行业动态 更新时间:2024-10-13 18:21:59

10.20<a href=https://www.elefans.com/category/jswz/34/1771149.html style=作业"/>

10.20作业

#include “widget.h”
#include “ui_widget.h”

Widget::Widget(QWidget *parent)
QWidget(parent)
, ui(new Ui::Widget)
{
ui->setupUi(this);
t = new QTimer(this);
connect(t, &QTimer::timeout, this, &Widget::timeout_Slot);
ui->text->setPlaceholderText(“请输入时间: :😗*”);
speecher = new QTextToSpeech(this);
}

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

void Widget::on_btn1_clicked()
{
if(“启动” == ui->btn1->text())
{
//启动一个定时器
t->start(1000);
}
}

void Widget::on_btn2_clicked()
{
if(“停止” == ui->btn2->text())
{
killTimer(tId);
speecher->stop();
}
}

void Widget::timeout_Slot()
{
QTime sys_tem = QTime::currentTime();

QString s = sys_tem.toString("hh:mm:ss");ui->lab1->setText(s);ui->lab1->setAlignment(Qt::AlignCenter);QString clock = ui->text->text();
if (clock == ui->lab1->text())
{int i = 0;while(i < 20){i++;speecher->say(ui->lab2->text());}
}

}

更多推荐

10.20作业

本文发布于:2023-12-06 18:55:33,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1668485.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:作业

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!