资源简介
基于Qt的C++小项目,主要场景为报账系统。

代码片段和文件信息
#include “account.h“
#include “ui_account.h“
#include
#include
#include
#include
const int NUMBER_PARAMETER = 18;
Account::Account(QWidget *parent) :
QDialog(parent)
ui(new Ui::Account)
{
ui->setupUi(this);
this->model = new Db_model();
this->ui->tbv_budget->setModel(this->model->tv_model);
}
Account::~Account()
{
delete ui;
}
void Account::on_le_detail_editingFinished()
{
//init the pro_spc
return;
}
void Account::on_pushButton_clicked()
{
// if some line edits are not cmpleted
if(this->ui->le_detail->text().isEmpty() || this->ui->le_money->text().isEmpty() || this->ui->le_name->text().isEmpty() || this->ui->le_person->text().isEmpty()){
QMessageBox msgBox;
msgBox.setText(“请输入全部信息“);
msgBox.exec();
return;
}
// already exist so display the information and enable some line edit
if(this->model->select_sigle_project(this->ui->le_name->text())){
this->ui->de_start_time->setTime(QTime::fromString(this->model->pro_spc.at(1)));
this->ui->de_end_time->setTime(QTime::fromString(this->model->pro_spc.at(2)));
this->ui->de_start_time->setEnabled(false);
this->ui->de_end_time->setEnabled(false);
}
else{
this->ui->de_start_time->setEnabled(true);
this->ui->de_end_time->setEnabled(true);
}
// use the input of ui to updata the pro_spc
for(int i=0; i this->model->pro_spc.append(QString::number(i));
this->model->pro_spc.replace(0 this->ui->le_name->text());
this->model->pro_spc.replace(1 this->ui->de_start_time->text());
this->model->pro_spc.replace(2 this->ui->de_end_time->text());
this->model->update_db(this->ui->le_money->text() this->ui->cbb_rb_type->currentIndex()
this->ui->le_detail->text());
}
void Account::on_btn_cancel_clicked()
{
this->close();
}
void Account::on_le_name_editingFinished()
{
//the project has existed unable some le
if(this->model->select_sigle_project(this->ui->le_name->text())){
this->ui->de_start_time->setTime(QTime::fromString(this->model->pro_spc.at(1)));
this->ui->de_end_time->setTime(QTime::fromString(this->model->pro_spc.at(2)));
this->ui->de_start_time->setEnabled(false);
this->ui->de_end_time->setEnabled(false);
}
else{
this->model->tv_model->clear();
this->model->set_tv_model_head();
this->ui->de_start_time->setEnabled(true);
this->ui->de_end_time->setEnabled(true);
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 2693 2018-09-27 15:25 Qt_Homework\account.cpp
文件 527 2018-09-27 15:25 Qt_Homework\account.h
文件 6509 2018-09-27 15:25 Qt_Homework\account.ui
文件 7981 2018-09-27 15:25 Qt_Homework\db_model.cpp
文件 1340 2018-09-27 15:25 Qt_Homework\db_model.h
文件 1213 2018-09-27 15:25 Qt_Homework\HomeWork.pro
文件 207379 2018-09-27 15:25 Qt_Homework\HomeWork.pro.user
文件 228 2018-09-27 15:25 Qt_Homework\main.cpp
文件 903 2018-09-27 15:25 Qt_Homework\mainwindow.cpp
文件 481 2018-09-27 15:25 Qt_Homework\mainwindow.h
文件 5196 2018-09-27 15:25 Qt_Homework\mainwindow.ui
文件 899 2018-09-27 15:25 Qt_Homework\query.cpp
文件 399 2018-09-27 15:25 Qt_Homework\query.h
文件 4111 2018-09-27 15:25 Qt_Homework\query.ui
..AD... 0 2018-09-27 19:49 Qt_Homework
----------- --------- ---------- ----- ----
239859 15
- 上一篇:数据结构的迷宫问题 C语言
- 下一篇:C++读取磁盘扇区数据
相关资源
- C++获取计算机的CPU ID,硬盘序列号等
- C++头文件转delphi工具 + 源码
- qTox (基于 peer-to-peer )
- 国际象棋的qt源代码
- C++中头文件与源文件的作用详解
- C++多线程网络编程Socket
- VC++ 多线程文件读写操作
- 利用C++哈希表的方法实现电话号码查
- 移木块游戏,可以自编自玩,vc6.0编写
- C++纯文字DOS超小RPG游戏
- VC++MFC小游戏实例教程(实例)+MFC类库
- 连铸温度场计算程序(C++)
- 6自由度机器人运动学正反解C++程序
- Em算法(使用C++编写)
- libstdc++-4.4.7-4.el6.i686.rpm
- VC++实现CMD命令执行与获得返回信息
- 白话C++(全)
- C++标准库第1、2
- 大数类c++大数类
- C++语言编写串口调试助手
- c++素数筛选法
- QT上位机
- qt媒体播放器
- QT5开发及源代码
- qt完整项目
- C++ mqtt 用法
- 商品库存管理系统 C++ MFC
- qt进度条(RoundProgressBar)
- Qt的纽带风格界面实现(Office Ribbon风
- qt 实现画板
评论
共有 条评论