今天的内容是用C++实现按钮的部分功能
首先是mywnd.cpp部分的代码
#include "mywnd.h"
#include <QDebug>
#include <QtTextToSpeech>
void mywnd::showMes()
{
// static int i=1;
//this->btn2->setText("关闭");
speech.say(btn3->text());
btn1->setEnabled(false);
}
//处理自定义信号的槽函数
void mywnd::say_mes()
{
// speech.say(btn2->text());
this->close();
}
void mywnd::restore()
{
speech.say(btn2->text());
btn1->setEnabled(true);
}
mywnd::mywnd(QWidget *parent)
: QWidget(parent)
{
this->resize(1024,768); //重新设置主控件大小
this->setMaximumSize(1500,1000); //设置最大尺寸
this->setMinimumSize(500,200); //设置最小尺寸
this->setFixedSize(888,666); //设置固定尺寸
//设置窗口标题
this->setWindowTitle("my_firstwindow");
//获取标题
QString title=this->windowTitle(); //得到窗口标题
qDebug()<<title;
//设置背景颜色,还得设置运行修改的权限
this->setBackgroundRole(QPalette::Dar
因篇幅问题不能全部显示,请点此查看更多更全内容
Copyright © 2019- huatuo0.com 版权所有 湘ICP备2023021991号-1
违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务