#include "setinfowidget.h" #include "ui_setinfowidget.h" #include "UIStyleManager.h" SetInfoWidget::SetInfoWidget(QWidget *parent) : QWidget(parent), ui(new Ui::SetInfoWidget) { ui->setupUi(this); /* 设置样式表 */ UIStyle.registerWidget(this); } SetInfoWidget::~SetInfoWidget() { /* 注销样式表 */ UIStyle.unregisterWidget(this); delete ui; } /* 设置WebAPI */ void SetInfoWidget::setWebAPI(FromWebAPI* api) { m_fromWebAPI = api; /* 设置BasicWidget的WebAPI */ BasicWidget* basicWidget = qobject_cast(ui->tabWidget->widget(0)); if(basicWidget) { basicWidget->setWebAPI(m_fromWebAPI); } } /* 保存按钮 */ void SetInfoWidget::do_pBtn_save_clicked() { saveData(); } /* 取消按钮 */ void SetInfoWidget::do_pBtn_cancel_clicked() { } /* 保存数据 */ void SetInfoWidget::saveData() { /* 获取当前页的编号 */ int currentIndex = ui->tabWidget->currentIndex(); QWidget* currentWidget = ui->tabWidget->currentWidget(); switch(currentIndex) { case 0: /* 基础信息 */ { BasicWidget* widget = qobject_cast(currentWidget); if(widget) { /* 保存基础信息 */ widget->saveBasicInfo(); } } break; case 1: /* 对比项 */ break; case 2: /* 噪音检测 */ break; case 3: /* 数据库 */ break; case 4: /* 检测时段 */ break; default: break; } }