#include "widget.h"
#include "ui_widget.h"
Widget::Widget(QWidget *parent)
: QWidget(parent)
, ui(new Ui::Widget)
, speecher(new QTextToSpeech(this))
{
ui->setupUi(this);
id = startTimer(1000);
}
Widget::~Widget()
{
delete ui;
}
void Widget::timerEvent(QTimerEvent *e)
{
QTime nowtime = QTime::currentTime();
QString s = nowtime.toString("hh:mm:ss");
ui->label_1->setText(s);
killTimer(id);
id = startTimer(1000);
}
void Widget::on_pushButton_2_clicked()
{
if(ui->lineEdit->text() == ui->label_1->text())
{
int num = 5;
//qDebug() << "aaa";
while(num--)
{
speecher->say(ui->label_3->text());
}
}
}
2024.3.26
于 2024-03-26 21:27:38 首次发布