12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- #include "setinfowidget.h"
- #include "ui_setinfowidget.h"
- #include "UIStyleManager.h"
- SetInfoWidget::SetInfoWidget(QWidget *parent) :
- QWidget(parent),
- ui(new Ui::SetInfoWidget)
- {
- ui->setupUi(this);
- /* 连接信号和槽 */
- connect(ui->pBtn_save, &QPushButton::clicked, this, &SetInfoWidget::do_pBtn_save_clicked);
- connect(ui->pBtn_cancel, &QPushButton::clicked, this, &SetInfoWidget::do_pBtn_cancel_clicked);
- /* 设置样式表 */
- 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<BasicWidget*>(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<BasicWidget*>(currentWidget);
- if(widget)
- {
- /* 保存基础信息 */
- widget->saveBasicInfo();
- }
- }
- break;
- case 1: /* 对比项 */
- break;
- case 2: /* 噪音检测 */
- break;
- case 3: /* 数据库 */
- break;
- case 4: /* 检测时段 */
- break;
- default:
- break;
- }
- }
|