转载:N3verL4nd

qttimer.h

 #ifndef QTTIMER_H
#define QTTIMER_H #include <QDialog> namespace Ui {
class qttimer;
} class qttimer : public QDialog
{
Q_OBJECT public:
explicit qttimer(QWidget *parent = );
~qttimer(); private:
Ui::qttimer *ui;
int count; private slots:
void slottimedown();
}; #endif // QTTIMER_H

qttimer.cpp

 #include "qttimer.h"
#include <QTime>
#include <QTimer>
#include <QLabel>
#include <QDateTime>
#include "ui_qttimer.h" qttimer::qttimer(QWidget *parent) : count()
, QDialog(parent),
ui(new Ui::qttimer)
{
ui->setupUi(this);
QTimer *time_clock = new QTimer(this);
connect(time_clock, SIGNAL(timeout()), this, SLOT(slottimedown()));
time_clock->start();
} qttimer::~qttimer()
{
delete ui;
} void qttimer::slottimedown()
{
QString value;
ui->timelabel->setText(value.setNum(count++));
QDateTime time = QDateTime::currentDateTime();
QString str = time.toString("yyyy-MM-dd dddd hh:mm:ss");
ui->datelabel->setText(str);
}

main.cpp

 #include "qttimer.h"
#include <QApplication> int main(int argc, char *argv[])
{
QApplication a(argc, argv);
qttimer w;
w.show();
return a.exec();
}

界面很简单,一个lable,两个lineEdit,然后更改对象名即可。

Qt QDateTime QTimer的简单实用的更多相关文章

  1. jQuery的几种简单实用效果

    许久未分享博客,或许已生疏. 闲来无事, 分享几个jQuery简单实用的效果案例 不喜勿喷... 1.页面常用的返回顶部 <!DOCTYPE html> <html lang=&qu ...

  2. 经验分享:10个简单实用的 jQuery 代码片段

    尽管各种 JavaScirpt 框架和库层出不穷,jQuery 仍然是 Web 前端开发中最常用的工具库.今天,向大家分享我觉得在网站开发中10个简单实用的 jQuery 代码片段. 您可能感兴趣的相 ...

  3. 简单实用的PHP防注入类实例

    这篇文章主要介绍了简单实用的PHP防注入类实例,以两个简单的防注入类为例介绍了PHP防注入的原理与技巧,对网站安全建设来说非常具有实用价值,需要的朋友可以参考下   本文实例讲述了简单实用的PHP防注 ...

  4. php简单实用的操作文件工具类(创建、移动、复制、删除)

    php简单实用好用的文件及文件夹复制函数和工具类(创建.移动.复制.删除) function recurse_copy($src,$dst) {  // 原目录,复制到的目录 $dir = opend ...

  5. 基于Bootstrap简单实用的tags标签插件

    http://www.htmleaf.com/jQuery/ jQuery之家 自由分享jQuery.html5和css3的插件库 基于Bootstrap简单实用的tags标签插件

  6. C#_简单实用的翻页

    简单实用的生成翻页HTML辅助类 C# using System.Text; namespace ClassLibrary { /// <summary> /// /// </sum ...

  7. 简单实用的Windows命令(一)

    前几天新买了一台笔记本电脑,使用了一下几个简单的查看电脑配置的命令,觉得非常的不错,在此记录一下 一:运行命令的方式有两种 1:使用快捷键WIN+R,然后在弹出的“运行”对话框中输入对应的命令 2:在 ...

  8. 简单实用的Windows命令(二)

    昨天简单的记录了几个非常简单实用的Windows命令,不过我又想起来还有两个我在实际的工作中也是经常用到的命令——PING和IPCONFIG,不过我在工作中的使用都是非常简单的,用PING命令检测对应 ...

  9. iOS边练边学--多线程介绍、NSThread的简单实用、线程安全以及线程之间的通信

    一.iOS中的多线程 多线程的原理(之前多线程这块没好好学,之前对多线程的理解也是错误的,这里更正,好好学习这块) iOS中多线程的实现方案有以下几种 二.NSThread线程类的简单实用(直接上代码 ...

随机推荐

  1. cf——Sasha and a Bit of Relax(dp,math)

    关于异或运算,是可以求前缀和的.还有一些异或运算的性质 0^a=a; 交换律 a^b=b^a 结合律 a^(b^c)=(a^b)^c 分配率 a^(b+c)=a^b+a^c 自反律 a^b^b=a 判 ...

  2. HDU5952 Counting Cliques (暴力深搜+剪枝) (2016ACM/ICPC亚洲赛区沈阳站 Problem E)

    题目链接:传送门 题目: Counting Cliques Time Limit: / MS (Java/Others) Memory Limit: / K (Java/Others) Total S ...

  3. P2157 [SDOI2009]学校食堂 (dp+状态压缩)

    题目链接:传送门 题目: 题目描述 小F 的学校在城市的一个偏僻角落,所有学生都只好在学校吃饭.学校有一个食堂,虽然简陋,但食堂大厨总能做出让同学们满意的菜肴.当然,不同的人口味也不一定相同,但每个人 ...

  4. Nginx访问日志、 Nginx日志切割、静态文件不记录日志和过期时间

    1.Nginx访问日志 配制访问日志:默认定义格式: log_format combined_realip '$remote_addr $http_x_forwarded_for [$time_loc ...

  5. 【Jmeter】插件

    一.插件管理 前提:很多时候,尤其是性能测试的时候,我们需要用到很多场景,需要得到一些参数值等等. 二.插件地址 URL : https://jmeter-plugins.org/downloads/ ...

  6. photoshop 笔记

    替换颜色 (图像)—(调整)—(替换颜色)—点下你想换掉的绿色----拖动下方的滑 块—(色相)拖到最大—(饱合度)调到最小----(明度)调到最大 OK 发现对你不想变色的图像稍微有点影响,但只是一 ...

  7. awesome-workflow-engines

    转自:https://github.com/meirwah/awesome-workflow-engines awesome-workflow-engines A curated list of aw ...

  8. 几个方便的nodejs 任务调度框架

    摘录几个方便的nodejs 任务调度包 node-cron https://github.com/kelektiv/node-cron node-schedule https://github.com ...

  9. python Console menu

    I just finished a demo which is to provide an easy way to control hardware resources of A sample. Th ...

  10. auto_ptr & share_ptr & unique_ptr

    Using auto_ptr, you don’t need think about the memory deallocation, but there are also many argument ...