#include "ProgrammPage.h" ProgrammPage::ProgrammPage(QWidget *parent) : QWidget(parent) { ui.setupUi(this); // 连接选项卡切换信号 connect(ui.tabWidget, &QTabWidget::currentChanged, this, &ProgrammPage::onTabChanged); initPage(); } ProgrammPage::~ProgrammPage() { } void ProgrammPage::initPage() { this->setAttribute(Qt::WA_DeleteOnClose); onTabChanged(0); //m_BondMatrixProgramPage = new BondMatrixProgramPage(this); //m_pWaffleProgrammPage = new WaffleProgramPage(this); //m_WaferProgramPage = new WaferProgramPage(this); //ui.verticalLayoutBondMatrix->addWidget(m_BondMatrixProgramPage); //ui.verticalLayoutWaffleMatrix->addWidget(m_pWaffleProgrammPage); //ui.verticalLayoutWaferMatrix->addWidget(m_WaferProgramPage); } void ProgrammPage::onTabChanged(int index) { switch (index) { case 0: // Bond Matrix 页面 if (!m_BondMatrixProgramPage) { qDebug() << "创建 BondMatrixProgramPage"; m_BondMatrixProgramPage = new BondMatrixProgramPage(this); ui.verticalLayoutBondMatrix->addWidget(m_BondMatrixProgramPage); } break; case 1: // Wafer 页面 if (!m_WaferProgramPage) { qDebug() << "创建 WaferProgramPage"; m_WaferProgramPage = new WaferProgramPage(this); ui.verticalLayoutWaferMatrix->addWidget(m_WaferProgramPage); } break; case 2: // Waffle 页面 if (!m_pWaffleProgrammPage) { qDebug() << "创建 WaffleProgramPage"; m_pWaffleProgrammPage = new WaffleProgramPage(this); ui.verticalLayoutWaffleMatrix->addWidget(m_pWaffleProgrammPage); } break; } }