QT5-控件-QTimeEdit和QTime
- #ifndef MAINWINDOW_H
- #define MAINWINDOW_H
- #include <QMainWindow>
- #include <QTimeEdit>
- #include <QTime>
- class MainWindow : public QMainWindow
- {
- Q_OBJECT
- public:
- MainWindow(QWidget *parent = );
- ~MainWindow();
- QTimeEdit* qte[];
- };
- #endif // MAINWINDOW_H
- #include "mainwindow.h"
- #include <QtDebug>
- MainWindow::MainWindow(QWidget *parent)
- : QMainWindow(parent)
- {
- this->resize(,);
- this->centralWidget();
- QTime ti1 = QTime(,,,);
- // 默认显示样式
- qte[] = new QTimeEdit(ti1,this);
- qte[]->setGeometry(,,,);
- // 指定格式显示样式
- qte[] = new QTimeEdit(ti1.addSecs(),this);
- qte[]->setGeometry(,,,);
- qte[]->setDisplayFormat("AP hh:mm:ss:zzz");
- qte[] = new QTimeEdit(ti1.addMSecs(),this);
- qte[]->setGeometry(,,,);
- qte[]->setDisplayFormat("AP hh:mm:ss:zzz");
- // // 从字符串转化为时间
- QTime ti2 ;
- qte[] = new QTimeEdit(ti2.fromString("23:30:30","hh:mm:ss"),this);
- qte[]->setGeometry(,,,);
- qte[]->setDisplayFormat("AP hh:mm:ss:zzz");
- // 将日期转化为指定格式字符串
- qDebug()<<"当前时间"<<QTime::currentTime().toString("AP hh:mm:ss:zzz");
- // 计算过程时间
- QTime ti3 ;
- ti3.start();
- for(int i=;i<;i++)
- {
- for(int i=;i<;i++)
- {
- }
- }
- qDebug()<<"刚刚经过了"<<ti3.elapsed()<<"毫秒";
- }
- 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-控件-QTimeEdit和QTime的更多相关文章
- QT5控件-QPushButton和QFocusFrame(按钮和焦点框)
#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> #include <QPushButton> ...
- QT5控件-QDateTimeEdit和类QDateTime
#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> #include <QDateTime> #i ...
- 日期与时间控件QDate, QTime, QDateTime
QDate类用于处理公历日期.QTime类用于处理时间.QDateTime类将QDate对象和QTime对象整合为一个对象 QDate: from PyQt5.QtCore import QDate, ...
- Qt5学习笔记(控件)
上面的程序仅仅可以显示一个 大概 的界面,对其进行单击等操作,界面仅有一些简单的反应,对应的程序不能得知界面有什么改变(是否进行单击选择,文本框中是否有文字输入) 下面对程序进行完善. T05Cont ...
- 我的QT5学习之路(三)——模板库、工具类和控件(下)
一.前言 作为第三篇的最后一部分,我们来看一下Qt的控件,谈到控件,就会让人想到界面的美观性和易操作性,进而想到开发的便捷性.作为windows界面开发的MFC曾经是盛行了多少年,但是其弊端也随着其他 ...
- Qt5 UI信号、槽自动连接的控件重名
Qt5 UI信号.槽自动连接的控件重名 来源 http://blog.csdn.net/goldenhawking/article/details/51865909 对Qt5稍有熟悉的童鞋都知道信号. ...
- Qt5 UI信号、槽自动连接的控件重名大坑(UI生成的槽函数存在一个隐患,即控件重名。对很复杂的控件,不要在 designer 里做提升,而是等到程序启动后,再动态创建,可以避免很多问题)
对Qt5稍有熟悉的童鞋都知道信号.槽的自动连接机制.该机制使得qt designer 设计的UI中包含的控件,可以不通过显式connect,直接和cpp中的相应槽相关联.该机制的详细文章见 http: ...
- Chapter2:Qt5模板库,工具类及控件
2.1 字符串类 QString类保存16位Unicode值,提供了丰富的操作,查询和转换等函数. (1):QString提供了一个二元的"+"操作符用于组合两个字符串 (2) ...
- QT5:第二章 布局排版控件
一.简介 在QT组件面板中有Layouts和Spacers两个组件面板 注意:布局排版控件不显示 1.Layouts(布局) Vertical Layout:垂直方向布局,组件自动在垂直方向上分布 H ...
随机推荐
- NOIP[2015] 运输计划
传送门 题目描述 Description 公元 2044 年,人类进入了宇宙纪元.L 国有 n 个星球,还有 n−1 条双向航道,每条航道建立在两个星球之间,这 n−1 条航道连通了 L 国的所有星球 ...
- 记 tower.im 的一次重构
原文in here: http://outofmemory.cn/wr?u=http%3A%2F%2Fblog.mycolorway.com%2F2013%2F05%2F01%2Ftower-refa ...
- 【Oracle】安装
http://www.2cto.com/database/201208/150620.html 呵呵,花了一个多小时,左右把11g安装折腾好了.其中折腾SQL Developer 花了好长时间,总算搞 ...
- Filter plugins ? mutate:
filter { grok { match => [ "message" , "\s*%{IPORHOST:clientip}\s+\-\s+\-\s+\[%{HT ...
- 【HDOJ】3285 Convex Hull of Lattice Points
凸包模板题目. /* 3285 */ #include <iostream> #include <cstdio> #include <cstring> #inclu ...
- How to make onActivityResult get called on Nested Fragment
One of the common problem we always meet in the world of Fragment is: although we could callstartAct ...
- ubuntu14.04.2 添加ppa remastersys源 镜像ubuntu系统
- VMware Ubuntu安装详细过程
参考链接: http://blog.csdn.net/u013142781/article/details/50529030
- Java字符串的最大长度
在cpp中为了可移植性,string的长度是string::size_type,突然就想知道java允许的最大字符串长度为多少.看String的源码: public final class Strin ...
- Hibernate的fetch
hibernate抓取策略fetch具体解释一.hibernate抓取策略(单端代理的批量抓取fetch=select(默认)/join)測试用例:Student student = (Student ...