QT常用类

来源:互联网 发布:淘宝客如何设置佣金 编辑:程序博客网 时间:2024/06/14 23:15

1、QDateTime

日期时间类

//使用当前时间和日期构造一个QDateTime对象QDateTime *datetime = new QDateTime(QDateTime::currentDateTime());qDebug()<<datetime->date().toString();      //返回日期值qDebug()<<datetime->time().toString();      //返回时间值

2、QTimer

定时器类

QTimer *timer = new QTimer(parent); //传入所在的父控件//设置的时间到后触发指定函数connect(timer,SIGNAL(timeout()),this,SLOT(TestFunction));//开启定时器timer->start(2000);         //两秒后重新启动定时器,会重复触发timer->setSingleShot(2000); //两秒后启动定时器,只启动一次//设置超时时间timer->setInterval(1000);   timer->stop();              //关闭定时器

3、标准对话框

这里写图片描述

0 0
原创粉丝点击