代码拉取完成,页面将自动刷新
#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;
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。