10.20作业

#include "widget.h"

#include "ui_widget.h"
:
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());
    }
}

}

相关推荐
用户805533698033 天前
不止三件套:QObject 属性系统全关键字与运行时反射!
c++·qt
xcyxiner3 天前
DicomViewer (vcpkg Windows和ubuntu编译)7
qt
Quz8 天前
QML Hello World 入门示例
qt
xcyxiner11 天前
DicomViewer (dcmtk读取dcm文件)5
qt
xcyxiner12 天前
DicomViewer (后台线程处理文件)4
qt
xcyxiner12 天前
DicomViewer (添加模型类)3
qt
xcyxiner13 天前
DicomViewer (目录调整) 2
qt
xcyxiner13 天前
dcmtk vtk vtk-dicom(gdcm) 编译(debug) v2
qt
桥田智能15 天前
桥田智能 QT-650S:面向白车身焊装的 800kg 重载快换解决方案
开发语言·qt·系统架构
森G15 天前
75、服务器源码解析---------云视频服务项目
linux·服务器·网络·c++·qt