资源简介
改例子是工作中从同事那里得到的参考例子,感觉经典,就留下来了,虽然内容不多,几乎涵盖了所有相关的操作,很好的参考例子,所以要留下来,方便以后使用

代码片段和文件信息
#include “AddInfoForm.h“
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include “DataStruct.h“
CAddInfoForm::CAddInfoForm(QWidget *pWid)
:QDialog(pWid) m_pInfo(nullptr) bChange(false)
{
setupUI();
m_pInfo = new SPersonInfo;
}
CAddInfoForm::~CAddInfoForm()
{
}
SPersonInfo* CAddInfoForm::getInfo()
{
return m_pInfo;
}
void CAddInfoForm::changeMode()
{
if (m_pLEName->text().length() > 0)
{
if (m_pLEPhone->text().length() == 0 || m_pLEPhone->text().length() == 11)
{
if (m_pDEDate->date() < QDate::currentDate())
{
m_pInfo->strName = m_pLEName->text();
m_pInfo->strAddr = m_pLEAddr->text();
//m_pInfo->eSex = Sex(m_pCBSex->currentIndex());
m_pInfo->bSex = m_pCBSex->currentIndex() == 0 ? false : true;
m_pInfo->strBirth = m_pDEDate->date().toString(“yyyy-MM-dd“);
m_pInfo->strPhone = m_pLEPhone->text();
bChange = true;
this->close();
return;
}
}
}
QMessageBox::warning(this “Error“ QStringLiteral(“信息录入错误“));
}
void CAddInfoForm::setupUI()
{
QLabel *pLblName = new QLabel(QStringLiteral(“姓名“));
QLabel *pLblSex = new QLabel(QStringLiteral(“性别“));
QLabel *pLblAddr = new QLabel(QStringLiteral(“住址“));
QLabel *pLblBirth = new QLabel(QStringLiteral(“生日“));
QLabel *pLblPhone = new QLabel(QStringLiteral(“电话“));
pBtnAdd = new QPushButton;
pBtnCancel = new QPushButton;
pBtnAdd->setText(QStringLiteral(“确定“));
pBtnCancel->setText(QStringLiteral(“取消“));
connect(pBtnAdd SIGNAL(clicked()) this SLOT(changeMode()));
connect(pBtnCancel SIGNAL(clicked()) this SLOT(close()));
m_pLEName = new QLineEdit;
m_pCBSex = new QComboBox;
m_pLEAddr = new QLineEdit;
m_pDEDate = new QDateEdit;
m_pLEPhone = new QLineEdit;
m_pCBSex->addItem(QIcon(“..\\image\\group_manager.png“) QStringLiteral(“男“));
m_pCBSex->addItem(QIcon(“..\\image\\group_creator.png“) QStringLiteral(“女“));
QRegExp regx(“^1(3[0-9]|4[57]|5[0-35-9]|7[0135678]|8[0-9])\\d{8}$“);
QValidator *validator = new QRegExpValidator(regx m_pLEPhone );
m_pLEPhone->setValidator(validator);
m_pDEDate->setCalendarPopup(true);
QHBoxLayout *playoutName = new QHBoxLayout;
QHBoxLayout *playoutSex = new QHBoxLayout;
QHBoxLayout *playoutAddr = new QHBoxLayout;
QHBoxLayout *playoutBirth = new QHBoxLayout;
QHBoxLayout *playoutPhone = new QHBoxLayout;
QHBoxLayout *playoutBtn = new QHBoxLayout;
QVBoxLayout *pmainLayout = new QVBoxLayout;
playoutName->addWidget(pLblName);
playoutName->addWidget(m_pLEName);
playoutSex->addWidget(pLblSex
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3884 2017-04-26 15:51 ModelViewText\AddInfoForm.cpp
文件 613 2017-04-26 15:51 ModelViewText\AddInfoForm.h
文件 6545 2017-04-26 15:51 ModelViewText\DataStruct.cpp
文件 1741 2017-04-26 15:51 ModelViewText\DataStruct.h
文件 193 2017-07-21 20:23 ModelViewText\main.cpp
文件 138 2017-07-21 20:20 ModelViewText\mainwindow.cpp
文件 227 2017-07-21 20:20 ModelViewText\mainwindow.h
文件 487 2017-07-21 20:22 ModelViewText\ModelViewText.pro
文件 18669 2017-07-21 20:22 ModelViewText\ModelViewText.pro.user
文件 1973 2017-07-21 20:24 ModelViewText\tongxunbook.cpp
文件 700 2017-04-26 15:51 ModelViewText\tongxunbook.h
目录 0 2017-07-21 20:24 ModelViewText
----------- --------- ---------- ----- ----
35170 12
相关资源
- TCP IP通信labview程序
- Power Electronic Converters Modeling and Contr
- ModelGoon-4.4.1-site.zip
- 酒店管理系统基于Qt Creator5)
- labview魔方程序
- res10_300x300_ssd_iter_140000.caffemodel与dep
- 一个labview仿真的函数信号发生器.vi
- labview编程软件滤波器以及编写程序设
- labview语音输入输出
- labview中的DAQ助手采集多个通道电压
- Labview与CH372CH375的通信测试
- LabVIEW钢琴实例
- 向SysListView32里的某一行发送双击消息
- vtk QT做的三维地质可视化系统2of2
- DOS播放器 QuickViewPro破解版
- Qt局域网聊天软件
- Qt Creator opengl实现四元数鼠标控制轨迹
- QT局域网聊天系统(基于QT5.修改过)
- qt-电子点菜系统
- C 餐厅叫号系统(QT平)
- QT 实现文件下载
- qt图像处理
- MSK调制解调的systemview仿真
- QT,JPEG解码源代码(已完成)
- 图片存储到数据库保存二进制文件并
- ModelSim全套中文手册ModelSim SE6.0C
- treeview详细使用(delphi)
- Qt 播放音频文件
- DataGridView财务金额格式显示
- Qt 读取16进制的data文件
评论
共有 条评论