[嵌入式Linux项目实战开发]基于QT4.8的仓库管理系统实现功能【2019年给力项目】
支持导出 excel 表格
支持查看商品操作日志
支持高精度浮点运算
支持同一商品以不同价格入库
该软件已开源。
因预览版 可执行文件过大,所以上传到csdn
大家有问题,可以加我的QQ1653687969
源码目录结构:
源码目录结构:
部分代码:
ContentWidget::ContentWidget(QWidget *parent) :
QWidget(parent)
{
sql_x = -1;
sql_y = -1;
tab_page = true;
search_page = false;
if(!sqlInit(false)){
QMessageBox message(QMessageBox::NoIcon, "提示", "请先选中一件库存商品");
message.setIconPixmap(QPixmap(":/img/safe"));
message.exec();
return;
}
// configure = new Configure;
// configure->readconfigure();
excelengine = new ExcelEngine;
QThread* daemon_thread = new QThread;
excelengine->moveToThread(daemon_thread);
daemon_thread->start(QThread::IdlePriority);
// connect(this, SIGNAL(saveExecl(QMap<int,QTableWidget *>)),excelengine, SIGNAL(signals_saveExecl(QMap<int,QTableWidget *>)));
// saveExecl(product_table);
main_widget = new QWidget(this);
storage_table = new QTableWidget(this);
product_table = new QTableWidget(this);
gmpmath = new GmpMath;
setToolsWidget();
setProductTab();
setStorageTab();
setTabWidget();
tabShow();
QPalette palette;
tools_widget->setAutoFillBackground(true);
main_widget->setAutoFillBackground(true);
palette.setColor(QPalette::Background,QColor(155,225,123));
tools_widget->setPalette(palette);
tools_widget->setFixedHeight(75);
main_splitter = new QSplitter(this);
main_splitter->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
main_splitter->setOrientation(Qt::Vertical);
main_splitter->setHandleWidth(0);
main_splitter->setStyleSheet("QSplitter::handle{background:lightgray;}");
main_splitter->addWidget(tools_widget);
// main_splitter->addWidget(left_widget);
main_splitter->addWidget(main_widget);
for(int i = 0; i<main_splitter->count();i++)
{
QSplitterHandle *handle = main_splitter->handle(i);
handle->setEnabled(false);
}
qDebug() << "content_ widget ok";
QHBoxLayout *main_layout = new QHBoxLayout();
main_layout->addWidget(main_splitter);
main_layout->setSpacing(0);
main_layout->setContentsMargins(0, 0, 0, 0);
connect(btn_add, SIGNAL(clicked()),this, SLOT(addwidget()));
connect(btn_minus, SIGNAL(clicked()),this, SLOT(minuswidget()));
connect(btn_plus, SIGNAL(clicked()),this, SLOT(pluswidget()));
connect(btn_delete, SIGNAL(clicked()),this, SLOT(sqldelete()));
connect(btn_cancel, SIGNAL(clicked()),this, SLOT(sqlcancel()));
connect(btn_outinto, SIGNAL(clicked()),this, SLOT(saveas()));
setLayout(main_layout);
// slotStyleChange(0);
btnEnable(false);
}
现在跟大家介绍一下软件实现界面:
初始化数据库
主界面
#include "main_menu.h"
MainMenu::MainMenu(QWidget *widget)
: QMenu(widget)
{
this->createActions();
this->translateActions();
}
void MainMenu::createActions()
{
//创建菜单项
action_sqlinit = new QAction(this);
action_changepasswd = new QAction(this);
action_sqlinit->setIcon(QIcon("img/safe.png"));
//添加菜单项
this->addAction(action_sqlinit);
this->addAction(action_changepasswd);
//设置信号连接
QObject::connect(action_sqlinit, SIGNAL(triggered()), this, SIGNAL(sqlinit_signal()));
QObject::connect(action_changepasswd, SIGNAL(triggered()), this, SIGNAL(changepasswd_signal()));
}
void MainMenu::translateActions()
{
action_sqlinit->setText(tr("初始化数据库"));
action_changepasswd->setText(tr("修改管理员密码"));
}
入库
出库
搜索商品
商品操作详情
删除商品
导出excel 表格
#include "excelengine.h"
ExcelEngine::ExcelEngine(QObject *parent) :
QObject(parent)
{