QT5练习

1

2

复制代码
#include "mywidget.h"
#include "ui_mywidget.h"

myWidget::myWidget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::myWidget)
{
    ui->setupUi(this);

    ui->label1->setAlignment(Qt::AlignCenter);
    speecher=new QTextToSpeech(this);
    startTimer(1000);
    emit settime();
}


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


void myWidget::timerEvent(QTimerEvent *e)
{

    emit settime();
    if(num==ui->label1->text())
    {
        for(int i=0;i<5;i++)
        {
            speecher->say("你是小黑子");
        }
        QMovie *mv=new QMovie("C:\\Users\\18065\\Desktop\\pictrue\\kun.gif");
        mv->setParent(this);
        ui->label3->setMovie(mv);
        mv->start();
        ui->label3->setScaledContents(true);
    }
}

void myWidget::settime()
{
    QTime time=QTime::currentTime();
    QString t=time.toString("hh:mm:ss");
    ui->label1->setText(t);
}
相关推荐
geovindu几秒前
python: speech to text offline
开发语言·python·语音识别
于指尖飞舞11 分钟前
java后端面试题(多线程极简)
java·开发语言
techdashen13 分钟前
从 Windows 的 ping.exe 入手:动态库、调用约定与 Rust FFI
开发语言·windows·rust
AI科技星40 分钟前
数术宇宙:零一无穷创世史诗
开发语言·网络·量子计算·拓扑学
是多巴胺不是尼古丁1 小时前
期末java复习--string
java·开发语言·python
Survivor0011 小时前
高并发系统流量治理的底层算法
java·开发语言
乌托邦2号1 小时前
Qt实现CS的自动化构建流程
qt·自动化
郝学胜-神的一滴1 小时前
CMake 017:彩色日志输出实战
linux·c语言·开发语言·c++·软件工程·软件构建·cmake
m0_547486661 小时前
《数字图像处理:使用MATLAB分析与实现》全套课件PPT
开发语言·matlab·powerpoint
Full Stack Developme2 小时前
Apache Tika 教程
java·开发语言·python·apache