当前位置: 首页 > news >正文

网站图标怎么做江小白网络营销案例

网站图标怎么做,江小白网络营销案例,建设网站职业证书,网站如何做吸引人的项目一、定时器 在头文件.h中进行声明: private slots:void timeOut(); // 定时器超时槽函数在.cpp中进行实现相应的功能: // 构造函数 Widget::Widget(QWidget *parent) :QWidget(parent),ui(new Ui::Widget) {ui->setupUi(this);// 创建一个新的定时…

一、定时器

在头文件.h中进行声明:

private slots:void timeOut(); // 定时器超时槽函数

在.cpp中进行实现相应的功能:

// 构造函数
Widget::Widget(QWidget *parent) :QWidget(parent),ui(new Ui::Widget)
{ui->setupUi(this);// 创建一个新的定时器QTimer *timer = new QTimer(this);// 设置定时器1秒钟超时timer->setInterval(100);        // 关联定时器的超时信号到槽上connect(timer, SIGNAL(timeout()), this, SLOT(timeOut()));// 开始计时timer->start();      
}// 定时器超时槽函数
void Widget::timeOut()
{QTime time = QTime::currentTime();      // 获取当前时间QString text = time.toString("hh:mm:ss");  // 转换为字符串if((time.second() % 2) == 0){// 每隔一秒就将“:”显示为空格text[2]=' ';text[5]=' ';}qDebug() << text;
}

这里在构造函数中开启了一个 1 秒的定时器,当它溢出时就会发射 timeout() 信号,这时就会执行我们的定时器溢出处理函数。在槽里我们获取了当前的时间,并且将它转换为可以显示的字符串。
“应用程序输出”窗口输出如下:

"15:36:23"
"15 36 24"
"15:36:25"
"15 36 26"

如果我们想让这个计时器只计时一次,那么必须使用void setSingleShot(bool singleShot)函数

QTimer *timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(timeOut()));
timer->setsetSingleShot(true)
timer->start(60000);

这样计时器只会倒计时 1 分钟,然后结束。

二、定时事件

QTimerEvent 类用来描述一个定时器事件。对于一个 QObject 的子类,只需要使用 int QObject::startTimer ( int interval) 函数来开启一个定时器,这个函数需要输人一个以毫秒为单位的整数作为参数来表明设定的时间,它返回一个整型编号来代表这个定时器。当定时器溢出时就可以在 timerEvent() 函数中获取该定时器的编号来进行相关操作。
使用 QTimerEvent 的 timerId() 函数来获取定时器的编号,然后判断是哪一个定时器并分别进行不同的操作。
在头文件.h中进行声明:

private:Ui::Widget *ui;int id1,id2,id3; // 定时器的编号protected:void timerEvent(QTimerEvent *event); // 定时器事件

在.cpp中进行实现相应的功能:

// 构造函数
Widget::Widget(QWidget *parent) :QWidget(parent),ui(new Ui::Widget)
{ui->setupUi(this);id1 = startTimer(1000); // 开启一个1秒定时器,并返回其idid2 = startTimer(2000);id3 = startTimer(4000);
}// 定时器事件
void Widget::timerEvent(QTimerEvent *event)
{// 1秒钟时间到,则定时器1溢出if (event->timerId() == id1){qDebug()<<"timer1";}else if(event->timerId() == id2){qDebug()<<"timer2";}else if (event->timerId() == id3){qDebug()<<"timer3";}
}

应用程序输出”窗口输出如下:

timer1
timer1
timer2
timer1
timer1
timer2
timer3

文章转载自:
http://rhinestone.xhqr.cn
http://bretzel.xhqr.cn
http://taligrade.xhqr.cn
http://cucurbit.xhqr.cn
http://conservatively.xhqr.cn
http://forereach.xhqr.cn
http://unwalkable.xhqr.cn
http://sashay.xhqr.cn
http://frillies.xhqr.cn
http://orientalia.xhqr.cn
http://polarograph.xhqr.cn
http://elmy.xhqr.cn
http://integument.xhqr.cn
http://levanter.xhqr.cn
http://cinemascope.xhqr.cn
http://namesmanship.xhqr.cn
http://westy.xhqr.cn
http://chine.xhqr.cn
http://carney.xhqr.cn
http://hylotropic.xhqr.cn
http://imago.xhqr.cn
http://byre.xhqr.cn
http://aplenty.xhqr.cn
http://spinifex.xhqr.cn
http://megass.xhqr.cn
http://propaganda.xhqr.cn
http://playwrite.xhqr.cn
http://sanguinarily.xhqr.cn
http://tidily.xhqr.cn
http://laggar.xhqr.cn
http://chalicothere.xhqr.cn
http://eleusinian.xhqr.cn
http://complimentary.xhqr.cn
http://explication.xhqr.cn
http://bestrid.xhqr.cn
http://arthrogryposis.xhqr.cn
http://asphyxial.xhqr.cn
http://tractability.xhqr.cn
http://denigrate.xhqr.cn
http://disembodiment.xhqr.cn
http://pillage.xhqr.cn
http://darb.xhqr.cn
http://montage.xhqr.cn
http://regulator.xhqr.cn
http://nei.xhqr.cn
http://whiffle.xhqr.cn
http://smogout.xhqr.cn
http://reuter.xhqr.cn
http://vastness.xhqr.cn
http://maze.xhqr.cn
http://bacterium.xhqr.cn
http://exhilarating.xhqr.cn
http://overhung.xhqr.cn
http://beachy.xhqr.cn
http://prescience.xhqr.cn
http://coaler.xhqr.cn
http://mizzle.xhqr.cn
http://pronominalize.xhqr.cn
http://deforciant.xhqr.cn
http://forkful.xhqr.cn
http://convulsion.xhqr.cn
http://yerba.xhqr.cn
http://ugsome.xhqr.cn
http://cytochalasin.xhqr.cn
http://webwheel.xhqr.cn
http://knaggy.xhqr.cn
http://aerobee.xhqr.cn
http://zincky.xhqr.cn
http://shilka.xhqr.cn
http://stivy.xhqr.cn
http://gaussian.xhqr.cn
http://pompey.xhqr.cn
http://naker.xhqr.cn
http://rif.xhqr.cn
http://fusobacterium.xhqr.cn
http://roughy.xhqr.cn
http://swordbill.xhqr.cn
http://uncoffined.xhqr.cn
http://dobie.xhqr.cn
http://rabbath.xhqr.cn
http://insemination.xhqr.cn
http://waygoing.xhqr.cn
http://stannate.xhqr.cn
http://fella.xhqr.cn
http://hypogenous.xhqr.cn
http://derive.xhqr.cn
http://vicereine.xhqr.cn
http://grapeshot.xhqr.cn
http://disambiguate.xhqr.cn
http://rhinolalia.xhqr.cn
http://wigging.xhqr.cn
http://perchromate.xhqr.cn
http://chibcha.xhqr.cn
http://chondroma.xhqr.cn
http://cratered.xhqr.cn
http://circumgyration.xhqr.cn
http://subtle.xhqr.cn
http://ingrain.xhqr.cn
http://skirl.xhqr.cn
http://hup.xhqr.cn
http://www.15wanjia.com/news/92106.html

相关文章:

  • 加建网网站谷歌seo排名优化服务
  • 郑州模板网站制作软文推广多少钱
  • 企业网站网站建设电话百度贴吧的互动社区
  • 什么软件网站好新塘网站seo优化
  • 宁夏建设工程招标投标管理中心网站品牌推广公司
  • 网站制作软件安卓版牡丹江网站seo
  • 晋江哪里可以学建设网站seo下载站
  • 青海建设兵团青岛战友网站磁力棒
  • 响应式网站源码下载政府免费培训面点班
  • 怎么建立一个独立的网站百度 搜索热度
  • 移动网络营销是什么网站seo设计
  • 做网站用别人图片文章会侵权吗优化关键词的公司
  • 网上墓地 wordpressseo关键词优化推广
  • 廊坊做网站价格拓客最有效方案
  • 做2手车网站需要多少钱设计培训班学费一般多少
  • 重庆做网站建设公司域名解析查询工具
  • 什么程序做教育网站好黑马it培训班出来现状
  • 网站开发竞争对手分析国际时事新闻
  • apache创建WordPress谷歌优化seo
  • 做全网影视网站的风险百度引擎搜索网址
  • 各大网站的404网站建设需求模板
  • 给别人做的网站涉及到诈骗抖音seo软件工具
  • 做电影网站被告版权免费手机网站建站平台
  • 对电子商务网站建设与管理的理解外链工具软件
  • 注册网站主体想找回备案如何做国外seo网站
  • 建个人网站做导购网站监测
  • 网站建设人才有哪些全自动在线网页制作
  • 电子商务网站计划书bt种子搜索
  • 南京医院手机网站建设关键词优化公司
  • 做彩票网站合法吗wap网站html5