#ifndef MAINWINDOW_H
#define MAINWINDOW_H #include <QMainWindow>
#include <QDateTime>
#include <QDateTimeEdit> class MainWindow : public QMainWindow
{
Q_OBJECT public:
MainWindow(QWidget *parent = );
~MainWindow(); QDateTimeEdit* dt[] ;
}; #endif // MAINWINDOW_H
#include "mainwindow.h"

MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
this->resize(,); // 按照指定格式显示日期时间
dt[] = new QDateTimeEdit(QDateTime::currentDateTime(),this);
dt[]->setDisplayFormat("yyyy-MM-dd hh:mm:ss:zzz");
dt[]->setGeometry(,,,);
// 指定时间微调范围,年月日都只可以调动2
dt[] = new QDateTimeEdit(QDateTime::currentDateTime(),this);
dt[]->setMaximumDateTime(QDateTime::currentDateTime().addYears());
dt[]->setMinimumDateTime(QDateTime::currentDateTime().addYears(-));
dt[]->setDisplayFormat("yyyy");
dt[]->setGeometry(,,,); dt[] = new QDateTimeEdit(QDateTime::currentDateTime(),this);
dt[]->setMaximumDateTime(QDateTime::currentDateTime().addMonths());
dt[]->setMinimumDateTime(QDateTime::currentDateTime().addMonths(-));
dt[]->setDisplayFormat("MM");
dt[]->setGeometry(,,,); dt[] = new QDateTimeEdit(QDateTime::currentDateTime(),this);
dt[]->setMaximumDateTime(QDateTime::currentDateTime().addDays());
dt[]->setMinimumDateTime(QDateTime::currentDateTime().addDays(-));
dt[]->setDisplayFormat("dd");
dt[]->setGeometry(,,,);
} MainWindow::~MainWindow()
{ }
#include "mainwindow.h"
#include <QApplication> int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show(); return a.exec();
}

QT5控件-QDateTimeEdit和类QDateTime的更多相关文章

  1. 背水一战 Windows 10 (34) - 控件(进度类): RangeBase, Slider, ProgressBar, ProgressRing

    [源码下载] 背水一战 Windows 10 (34) - 控件(进度类): RangeBase, Slider, ProgressBar, ProgressRing 作者:webabcd 介绍背水一 ...

  2. 背水一战 Windows 10 (33) - 控件(选择类): ListBox, RadioButton, CheckBox, ToggleSwitch

    [源码下载] 背水一战 Windows 10 (33) - 控件(选择类): ListBox, RadioButton, CheckBox, ToggleSwitch 作者:webabcd 介绍背水一 ...

  3. 背水一战 Windows 10 (32) - 控件(选择类): Selector, ComboBox

    [源码下载] 背水一战 Windows 10 (32) - 控件(选择类): Selector, ComboBox 作者:webabcd 介绍背水一战 Windows 10 之 控件(选择类) Sel ...

  4. 背水一战 Windows 10 (31) - 控件(按钮类): ButtonBase, Button, HyperlinkButton, RepeatButton, ToggleButton, AppBarButton, AppBarToggleButton

    [源码下载] 背水一战 Windows 10 (31) - 控件(按钮类): ButtonBase, Button, HyperlinkButton, RepeatButton, ToggleButt ...

  5. 背水一战 Windows 10 (30) - 控件(文本类): AutoSuggestBox

    [源码下载] 背水一战 Windows 10 (30) - 控件(文本类): AutoSuggestBox 作者:webabcd 介绍背水一战 Windows 10 之 控件(文本类) AutoSug ...

  6. 背水一战 Windows 10 (29) - 控件(文本类): RichTextBlock, RichTextBlockOverflow, RichEditBox

    [源码下载] 背水一战 Windows 10 (29) - 控件(文本类): RichTextBlock, RichTextBlockOverflow, RichEditBox 作者:webabcd ...

  7. 背水一战 Windows 10 (28) - 控件(文本类): TextBox, PasswordBox

    [源码下载] 背水一战 Windows 10 (28) - 控件(文本类): TextBox, PasswordBox 作者:webabcd 介绍背水一战 Windows 10 之 控件(文本类) T ...

  8. 背水一战 Windows 10 (27) - 控件(文本类): TextBlock

    [源码下载] 背水一战 Windows 10 (27) - 控件(文本类): TextBlock 作者:webabcd 介绍背水一战 Windows 10 之 控件(文本类) TextBlock 示例 ...

  9. iOS控件之UIResponder类

    iOS控件之UIResponder类 在iOS中UIResponder类是专门用来响应用户的操作处理各种事件的,我们知道UIApplication.UIView.UIViewController这几个 ...

随机推荐

  1. 使用putty登陆cygwin出现server unexpectedly ...error.解决方案

    将cygwin安装目录下/etc/passwd中的passwd文件中user:unused:32707:10513:U-CYOU-INC\user,S-1-5-21-2645613570-259884 ...

  2. MVC4 教程

    http://blog.csdn.net/huangjihua0402/article/details/8507055 http://www.cnblogs.com/lc-chenlong/p/324 ...

  3. hdu Co-prime

    题意:求出在一个区间[A,B]内与N互质的个数 . 思路: 先求出n的质因子,然后求出与N的质因子不互质的个数然后总个数减去就是.用位运算二进制表示那个因子用到过,实现容斥原理.在1到n之间是c倍数的 ...

  4. Autodesk 开源 3D 打印机

    Autodesk 开源 3D 打印机 Autodesk在知识共享-署名-相同方式共享许可证下公开了其3D打印机Ember的树脂.机械设计.电路图纸的细节,在GNU GPL许可证下公开了固件.打印机运行 ...

  5. 【数学】HDU 5753 Permutation Bo

    题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5753 题目大意: 两个序列h和c,h为1~n的乱序.h[0]=h[n+1]=0,[A]表示A为真则为 ...

  6. File System Minifilter Drivers(文件系统微型过滤驱动)入门

    问题: 公司之前有一套文件过滤驱动,但是在实施过程中经常出现问题,现在交由我维护.于是在边看代码的过程中,一边查看官方资料,进行整理. 这套文件过滤驱动的目的只要是根据应用层下发的策略来控制对某些特定 ...

  7. Linux文件操作学习总结【转载】

    本文转载自: http://blog.csdn.net/xiaoweibeibei/article/details/6556951 文件类型:普通文件(文本文件,二进制文件).目录文件.链接文件.设备 ...

  8. selenium webdriver python 操作浏览器

    新建driver driver=webdriver.Firefox() driver=webdriver.Ie() driver=webdriver.Chrome()   打开一个链接 driver. ...

  9. Back to Basics: Using KVO

    One of the things I like most about Apple’s iOS SDK is the consistent and easy-to-use API they provi ...

  10. oracle的shutdown命令有几种参数

    SHUTDOWN NORMAL:不允许新的连接.等待会话结束.等待事务结束.做一个检查点并关闭数据文件.启动时不需要实例恢复.SHUTDOWN TRANSACTIONAL:不允许新的连接.不等待会话结 ...