2 Star 0 Fork 0

SmartFridge/fridge_terminal

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
remindadd.cpp 2.06 KB
一键复制 编辑 原始数据 按行查看 历史
#include "remindadd.h"
#include "ui_remindadd.h"
#include <QToolButton>
#include <QDebug>
#include "mycalendarwidget.h"
#include <QDate>
#include <QMessageBox>
RemindAdd::RemindAdd(QWidget *parent) :
QWidget(parent),
ui(new Ui::RemindAdd)
{
ui->setupUi(this);
showFullScreen();
ui->foodSelect->setParent(this);
connect(ui->btn_back,&QToolButton::clicked,[=](){
this->close();
// ui->stackedWidget->setCurrentIndex(ui->stackedWidget->currentIndex()+1);
});
connect(ui->btn_complete,&QToolButton::clicked,[=](){
if (haveSelected&&(ui->amount->text()!=NULL&&ui->amount->text()!="")){
int amount = ui->amount->text().toInt();
if (amount<=0){
QMessageBox::critical(this, tr("存储添加错误"), tr("请输入正确的数量,且保证数量>0"));
}
else{
sql.remindAdd(this->selected.create_user,this->selected.create_id,amount,ui->dateEdit->date());
qDebug()<<"成功添加";
emit completed();
this->close();
}
}
// sql更新
emit completed();
});
connect(ui->foodSelect,&FoodSelect::selected,this,[=](Food food){
this->selected = food;
this->haveSelected = true;
ui->label_name->setText("食物:"+food.name);
});
ui->dateEdit->setCalendarPopup(true);
ui->dateEdit->setCalendarWidget(new MyCalendarWidget);
ui->dateEdit->setDate(QDate::currentDate());
QToolButton *prevBtn = ui->dateEdit->findChild<QToolButton*>(QLatin1String("qt_calendar_prevmonth"));
QToolButton *bextBtn = ui->dateEdit->findChild<QToolButton*>(QLatin1String("qt_calendar_nextmonth"));
prevBtn->setFixedSize(50,50);
bextBtn->setFixedSize(50,50);
prevBtn->setIcon(QIcon(":/img/res/img/forward_left.png"));
prevBtn->setIconSize(QSize(50,50));
bextBtn->setIcon(QIcon(":/img/res/img/forward_right.png"));
bextBtn->setIconSize(QSize(50,50));
}
RemindAdd::~RemindAdd()
{
delete ui;
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/smart-ice-box/fridge_terminal.git
git@gitee.com:smart-ice-box/fridge_terminal.git
smart-ice-box
fridge_terminal
fridge_terminal
master

搜索帮助