- #include "widget.h"
- #include "ui_widget.h"
-
- Widget::Widget(QWidget *parent)
- : QWidget(parent)
- , ui(new Ui::Widget)
- {
- ui->setupUi(this);
- speecher = new QTextToSpeech(this);
- tid = startTimer(1000);
- }
-
- Widget::~Widget()
- {
- delete ui;
- }
-
-
-
- void Widget::on_btn1_clicked()
- {
- s = ui->lineEdit->text();
- id = startTimer(1000);
- }
- void Widget::on_btn1_2_clicked()
- {
- killTimer(id);
- }
-
- void Widget::timerEvent(QTimerEvent *e)
- {
- QTime s_time= QTime::currentTime();
- QString k =s_time.toString("hh:mm:ss");
- if(e->timerId()==tid)
- {
- ui->lab1->setText(k);
- ui->lab1->setAlignment(Qt::AlignCenter);
- }
-
- if(e->timerId()==id)
- {
- if(s==k)
- {
- for(int i=0;i<3;i++)
- speecher->say(ui->lab3->text());
- }
- }
-
- }
-
-