#include "WaffleProgramPage.h" #include #include #include "Src/RewriteControl/Controls/SpinBox.h" #include "Src/RewriteControl/Controls/DoubleSpinBox.h" #include WaffleProgramPage::WaffleProgramPage(QWidget* parent) :QWidget(parent) { ui.setupUi(this); setStyleSheet( "QDoubleSpinBox{background: #FFFFFF;border: 1px solid #BABBDC;border - radius: 6px;padding: 2px 5px;}" "QSpinBox{background: #FFFFFF;border: 1px solid #BABBDC;border - radius: 6px;padding: 2px 5px;}" "QLineEdit{background: #FFFFFF;border: 1px solid #BABBDC;border - radius: 6px;padding: 2px 5px;}" "QCheckBox::indicator{width: 20px;height: 20px;}" "QCheckBox::indicator:unchecked{background - color: #FFFFFF;border-radius: 2px;}" "QComboBox{background: #FFFFFF;border: 1px solid #BABBDC;border - radius: 6px;padding: 2px 5px;}" "QComboBox::drop - down{width: 20px;}" ); m_manageDB = CManageDB::GetInstance(); if (m_manageDB == nullptr) return; m_pProduct = m_manageDB->GetCProduct(); if (m_pProduct == nullptr) return; initPage(); } WaffleProgramPage::~WaffleProgramPage() { } void WaffleProgramPage::AddMatrixPage(int vectorIndex, PROGRAM_WAFFLE_MATRIX_STRUCT matrixData, std::vector vecSubMatrix) { int matrixNum = m_mapSubMatrixControls.size(); int newMatrixID = ++matrixNum; QVector vecControls; QGroupBox* groupBox = new QGroupBox(); QGridLayout* outMatrixGridLayout = new QGridLayout(); outMatrixGridLayout->setSpacing(6); outMatrixGridLayout->setObjectName(QString::fromUtf8("subGridLayout")); groupBox->setLayout(outMatrixGridLayout); QGridLayout* subGridLayout = new QGridLayout(); subGridLayout->setSpacing(6); subGridLayout->setObjectName(QString::fromUtf8("subGridLayout")); //groupBox->setLayout(subGridLayout); QLabel* labelTitle = new QLabel(this); labelTitle->setObjectName(QString::fromUtf8("labelTitle")); labelTitle->setText(tr("Sub Matrix ") + QString::number(vectorIndex)); subGridLayout->addWidget(labelTitle, 0, 0, 1, 1); vecControls.push_back(labelTitle); QLabel* labelRow = new QLabel(this); labelRow->setObjectName(QString::fromUtf8("labelRow")); labelRow->setText(tr("Row ")); subGridLayout->addWidget(labelRow, 1, 0, 1, 1); vecControls.push_back(labelRow); SpinBox* spinBoxRow = new SpinBox(this); spinBoxRow->setObjectName(QString::fromUtf8("spinBoxRow")); subGridLayout->addWidget(spinBoxRow, 1, 1, 1, 1); vecControls.push_back(spinBoxRow); QLabel* labelCol = new QLabel(this); labelCol->setObjectName(QString::fromUtf8("labelCol")); labelCol->setText(tr("Cow ")); subGridLayout->addWidget(labelCol, 2, 0, 1, 1); vecControls.push_back(labelCol); SpinBox* spinBoxCol = new SpinBox(this); spinBoxCol->setObjectName(QString::fromUtf8("spinBoxCol")); subGridLayout->addWidget(spinBoxCol, 2, 1, 1, 1); vecControls.push_back(spinBoxCol); QLabel* labelLeftTop = new QLabel(this); labelLeftTop->setObjectName(QString::fromUtf8("labelLeftTop")); labelLeftTop->setText(tr("Left Top Pos ")); subGridLayout->addWidget(labelLeftTop, 4, 0, 1, 1); vecControls.push_back(labelLeftTop); DoubleSpinBox* doubleSpinBoxLeftTopX = new DoubleSpinBox(this); doubleSpinBoxLeftTopX->setObjectName(QString::fromUtf8("doubleSpinBoxLeftTopX")); subGridLayout->addWidget(doubleSpinBoxLeftTopX, 4, 1, 1, 1); vecControls.push_back(doubleSpinBoxLeftTopX); DoubleSpinBox* doubleSpinBoxLeftTopY = new DoubleSpinBox(this); doubleSpinBoxLeftTopY->setObjectName(QString::fromUtf8("doubleSpinBoxLeftTopY")); subGridLayout->addWidget(doubleSpinBoxLeftTopY, 4, 2, 1, 1); vecControls.push_back(doubleSpinBoxLeftTopY); QLabel* labelRightTopPos = new QLabel(this); labelRightTopPos->setObjectName(QString::fromUtf8("labelRightTopPos")); labelRightTopPos->setText(tr("Right Top Pos ")); subGridLayout->addWidget(labelRightTopPos, 5, 0, 1, 1); vecControls.push_back(labelRightTopPos); DoubleSpinBox* doubleSpinBoxRightTopX = new DoubleSpinBox(this); doubleSpinBoxRightTopX->setObjectName(QString::fromUtf8("doubleSpinBoxRightTopX")); subGridLayout->addWidget(doubleSpinBoxRightTopX, 5, 1, 1, 1); vecControls.push_back(doubleSpinBoxRightTopX); DoubleSpinBox* doubleSpinBoxRightTopY = new DoubleSpinBox(this); doubleSpinBoxRightTopY->setObjectName(QString::fromUtf8("doubleSpinBoxRightTopY")); subGridLayout->addWidget(doubleSpinBoxRightTopY, 5, 2, 1, 1); vecControls.push_back(doubleSpinBoxRightTopY); QLabel* labelRightButtomPos = new QLabel(this); labelRightButtomPos->setObjectName(QString::fromUtf8("labelRightButtomPos")); labelRightButtomPos->setText(tr("Right Buttom pos")); subGridLayout->addWidget(labelRightButtomPos, 6, 0, 1, 1); vecControls.push_back(labelRightButtomPos); DoubleSpinBox* doubleSpinBoxRightButtomX = new DoubleSpinBox(this); doubleSpinBoxRightButtomX->setObjectName(QString::fromUtf8("doubleSpinBoxRightButtomX")); subGridLayout->addWidget(doubleSpinBoxRightButtomX, 6, 1, 1, 1); vecControls.push_back(doubleSpinBoxRightButtomX); DoubleSpinBox* doubleSpinBoxRightButtomY = new DoubleSpinBox(this); doubleSpinBoxRightButtomY->setObjectName(QString::fromUtf8("doubleSpinBoxRightButtomY")); subGridLayout->addWidget(doubleSpinBoxRightButtomY, 6, 2, 1, 1); vecControls.push_back(doubleSpinBoxRightTopX); QLabel* labelNoBondPts = new QLabel(this); labelNoBondPts->setObjectName(QString::fromUtf8("labelNoBondPts")); labelNoBondPts->setText(tr("No Bond Points")); subGridLayout->addWidget(labelNoBondPts, 7, 0, 1, 1); vecControls.push_back(labelNoBondPts); QLineEdit* lineEditNoBondPts = new QLineEdit(this); lineEditNoBondPts->setObjectName(QString::fromUtf8("lineEditNoBondPts")); subGridLayout->addWidget(lineEditNoBondPts, 7, 1, 1, 2); vecControls.push_back(lineEditNoBondPts); outMatrixGridLayout->addLayout(subGridLayout, 0, 0); QFrame* line = new QFrame(); line->setFrameShape(QFrame::NoFrame); // 移除默认框架 line->setFixedHeight(2); // 设置固定高度 line->setStyleSheet("background-color: #C7CAEB;"); outMatrixGridLayout->addWidget(line); ui.verticalLayout->addWidget(groupBox); for (int j = 0; j < matrixData.VecDieMatrixId.size(); j++) { for (int i = 0; i < m_vecSubWaffleMatrix.size(); i++) { if (matrixData.VecDieMatrixId[j] == m_vecSubWaffleMatrix[i].MatrixId) { AddSubMatrixPage(i, m_vecSubWaffleMatrix[i], outMatrixGridLayout); } } } //for (int i = 0; i = vecSubMatrix.size(); i++) //{ // AddSubMatrixPage(i, vecSubMatrix[i], outMatrixGridLayout); //} connect(spinBoxRow, &SpinBox::editDone, this, [=]() { m_vecWaffleMatrix[vectorIndex].PackRow = spinBoxRow->value(); }); connect(spinBoxCol, &SpinBox::editDone, this, [=]() { m_vecWaffleMatrix[vectorIndex].PackCol = spinBoxCol->value(); }); connect(doubleSpinBoxLeftTopX, &DoubleSpinBox::editDone, this, [=]() { m_vecWaffleMatrix[vectorIndex].LeftTopPoint.x = doubleSpinBoxLeftTopX->value(); }); connect(doubleSpinBoxLeftTopY, &DoubleSpinBox::editDone, this, [=]() { m_vecWaffleMatrix[vectorIndex].LeftTopPoint.y = doubleSpinBoxLeftTopY->value(); }); connect(doubleSpinBoxRightTopX, &DoubleSpinBox::editDone, this, [=]() { m_vecWaffleMatrix[vectorIndex].RightTopPoint.x = doubleSpinBoxRightTopX->value(); }); connect(doubleSpinBoxRightTopY, &DoubleSpinBox::editDone, this, [=]() { m_vecWaffleMatrix[vectorIndex].RightTopPoint.y = doubleSpinBoxRightTopY->value(); }); connect(doubleSpinBoxRightButtomX, &DoubleSpinBox::editDone, this, [=]() { m_vecWaffleMatrix[vectorIndex].RightBottomPoint.x = doubleSpinBoxRightButtomX->value(); }); connect(doubleSpinBoxRightButtomY, &DoubleSpinBox::editDone, this, [=]() { m_vecWaffleMatrix[vectorIndex].RightBottomPoint.y = doubleSpinBoxRightButtomY->value(); }); connect(lineEditNoBondPts, &QLineEdit::textChanged, this, [=]() { }); } void WaffleProgramPage::AddSubMatrixPage(int subVectorIndex, PROGRAM_DIE_MATRIX_STRUCT subMatrix, QGridLayout* layout) { QVector vecControls; QGridLayout* subGridLayout = new QGridLayout(); subGridLayout->setSpacing(6); subGridLayout->setObjectName(QString::fromUtf8("subGridLayout")); //groupBox->setLayout(subGridLayout); QLabel* labelTitle = new QLabel(this); labelTitle->setObjectName(QString::fromUtf8("labelTitle")); labelTitle->setText(tr("Sub Matrix ") + QString::number(subVectorIndex)); subGridLayout->addWidget(labelTitle, 0, 0, 1, 1); vecControls.push_back(labelTitle); labelTitle->setStyleSheet("background-color: #F0F0F0;"); QLabel* labelRow = new QLabel(this); labelRow->setObjectName(QString::fromUtf8("labelRow")); labelRow->setText(tr("Row ")); subGridLayout->addWidget(labelRow, 1, 0, 1, 1); vecControls.push_back(labelRow); SpinBox* spinBoxRow = new SpinBox(this); spinBoxRow->setObjectName(QString::fromUtf8("spinBoxRow")); subGridLayout->addWidget(spinBoxRow, 1, 1, 1, 1); vecControls.push_back(spinBoxRow); QLabel* labelCol = new QLabel(this); labelCol->setObjectName(QString::fromUtf8("labelCol")); labelCol->setText(tr("Cow ")); subGridLayout->addWidget(labelCol, 2, 0, 1, 1); vecControls.push_back(labelCol); SpinBox* spinBoxCol = new SpinBox(this); spinBoxCol->setObjectName(QString::fromUtf8("spinBoxCol")); subGridLayout->addWidget(spinBoxCol, 2, 1, 1, 1); vecControls.push_back(spinBoxCol); QLabel* labelLeftTop = new QLabel(this); labelLeftTop->setObjectName(QString::fromUtf8("labelLeftTop")); labelLeftTop->setText(tr("Left Top Pos ")); subGridLayout->addWidget(labelLeftTop, 4, 0, 1, 1); vecControls.push_back(labelLeftTop); DoubleSpinBox* doubleSpinBoxLeftTopX = new DoubleSpinBox(this); doubleSpinBoxLeftTopX->setObjectName(QString::fromUtf8("doubleSpinBoxLeftTopX")); subGridLayout->addWidget(doubleSpinBoxLeftTopX, 4, 1, 1, 1); vecControls.push_back(doubleSpinBoxLeftTopX); DoubleSpinBox* doubleSpinBoxLeftTopY = new DoubleSpinBox(this); doubleSpinBoxLeftTopY->setObjectName(QString::fromUtf8("doubleSpinBoxLeftTopY")); subGridLayout->addWidget(doubleSpinBoxLeftTopY, 4, 2, 1, 1); vecControls.push_back(doubleSpinBoxLeftTopY); QLabel* labelRightTopPos = new QLabel(this); labelRightTopPos->setObjectName(QString::fromUtf8("labelRightTopPos")); labelRightTopPos->setText(tr("Right Top Pos ")); subGridLayout->addWidget(labelRightTopPos, 5, 0, 1, 1); vecControls.push_back(labelRightTopPos); DoubleSpinBox* doubleSpinBoxRightTopX = new DoubleSpinBox(this); doubleSpinBoxRightTopX->setObjectName(QString::fromUtf8("doubleSpinBoxRightTopX")); subGridLayout->addWidget(doubleSpinBoxRightTopX, 5, 1, 1, 1); vecControls.push_back(doubleSpinBoxRightTopX); DoubleSpinBox* doubleSpinBoxRightTopY = new DoubleSpinBox(this); doubleSpinBoxRightTopY->setObjectName(QString::fromUtf8("doubleSpinBoxRightTopY")); subGridLayout->addWidget(doubleSpinBoxRightTopY, 5, 2, 1, 1); vecControls.push_back(doubleSpinBoxRightTopY); QLabel* labelRightButtomPos = new QLabel(this); labelRightButtomPos->setObjectName(QString::fromUtf8("labelRightButtomPos")); labelRightButtomPos->setText(tr("Right Buttom pos")); subGridLayout->addWidget(labelRightButtomPos, 6, 0, 1, 1); vecControls.push_back(labelRightButtomPos); DoubleSpinBox* doubleSpinBoxRightButtomX = new DoubleSpinBox(this); doubleSpinBoxRightButtomX->setObjectName(QString::fromUtf8("doubleSpinBoxRightButtomX")); subGridLayout->addWidget(doubleSpinBoxRightButtomX, 6, 1, 1, 1); vecControls.push_back(doubleSpinBoxRightButtomX); DoubleSpinBox* doubleSpinBoxRightButtomY = new DoubleSpinBox(this); doubleSpinBoxRightButtomY->setObjectName(QString::fromUtf8("doubleSpinBoxRightButtomY")); subGridLayout->addWidget(doubleSpinBoxRightButtomY, 6, 2, 1, 1); vecControls.push_back(doubleSpinBoxRightTopX); QLabel* labelNoBondPts = new QLabel(this); labelNoBondPts->setObjectName(QString::fromUtf8("labelNoBondPts")); labelNoBondPts->setText(tr("No Bond Points")); subGridLayout->addWidget(labelNoBondPts, 7, 0, 1, 1); vecControls.push_back(labelNoBondPts); QLineEdit* lineEditNoBondPts = new QLineEdit(this); lineEditNoBondPts->setObjectName(QString::fromUtf8("lineEditNoBondPts")); subGridLayout->addWidget(lineEditNoBondPts, 7, 1, 1, 2); vecControls.push_back(lineEditNoBondPts); layout->addLayout(subGridLayout, 11, 0); QFrame* line = new QFrame(); line->setFrameShape(QFrame::NoFrame); // 移除默认框架 line->setFixedHeight(2); // 设置固定高度 line->setStyleSheet("background-color: #C7CAEB;"); ui.verticalLayout->addWidget(line); connect(spinBoxRow, &SpinBox::editDone, this, [=]() { m_vecSubWaffleMatrix[subVectorIndex].MatrixRow = spinBoxRow->value(); }); connect(spinBoxCol, &SpinBox::editDone, this, [=]() { m_vecSubWaffleMatrix[subVectorIndex].MatrixCol = spinBoxCol->value(); }); connect(doubleSpinBoxLeftTopX, &DoubleSpinBox::editDone, this, [=]() { m_vecSubWaffleMatrix[subVectorIndex].LeftTopPoint.x = doubleSpinBoxLeftTopX->value(); }); connect(doubleSpinBoxLeftTopY, &DoubleSpinBox::editDone, this, [=]() { m_vecSubWaffleMatrix[subVectorIndex].LeftTopPoint.y = doubleSpinBoxLeftTopY->value(); }); connect(doubleSpinBoxRightTopX, &DoubleSpinBox::editDone, this, [=]() { m_vecSubWaffleMatrix[subVectorIndex].RightTopPoint.x = doubleSpinBoxRightTopX->value(); }); connect(doubleSpinBoxRightTopY, &DoubleSpinBox::editDone, this, [=]() { m_vecSubWaffleMatrix[subVectorIndex].RightTopPoint.y = doubleSpinBoxRightTopY->value(); }); connect(doubleSpinBoxRightButtomX, &DoubleSpinBox::editDone, this, [=]() { m_vecSubWaffleMatrix[subVectorIndex].RightBottomPoint.x = doubleSpinBoxRightButtomX->value(); }); connect(doubleSpinBoxRightButtomY, &DoubleSpinBox::editDone, this, [=]() { m_vecSubWaffleMatrix[subVectorIndex].RightBottomPoint.y = doubleSpinBoxRightButtomY->value(); }); connect(lineEditNoBondPts, &QLineEdit::textChanged, this, [=]() { }); } void WaffleProgramPage::SaveAllParam() { } void WaffleProgramPage::MatrixChangeEvent() { for (PROGRAM_WAFFLE_MATRIX_STRUCT& waffleMatrix : m_vecWaffleMatrix) { m_pProduct->SetWaffleMatrix(waffleMatrix.MatrixId, waffleMatrix); } m_pProduct->SetDieMatrix(m_vecSubWaffleMatrix, true); //for (PROGRAM_BOND_MATRIX_STRUCT& bondMatrix : m_vecWaffleMatrix) //{ // m_manageDB->GetCProduct()->SetBondMatrix(bondMatrix.BondMatrixId, bondMatrix); //} //for (PROGRAM_POINT_MATRIX_STRUCT& pointMatrix : m_vecSubMatrixs) //{ // m_manageDB->GetCProduct()->SetPointMatrix(pointMatrix.MatrixId, pointMatrix); //} } void WaffleProgramPage::initPage() { m_vecWaffleMatrix = m_pProduct->GetWaffleMatrix(); for (int i = 0; i < m_vecWaffleMatrix.size(); i++) { for (int j = 0; j < m_vecWaffleMatrix[i].VecDieMatrixId.size(); j++) { PROGRAM_DIE_MATRIX_STRUCT subMatrix; m_pProduct->GetDieMatrix(m_vecWaffleMatrix[i].VecDieMatrixId[j], subMatrix); m_vecSubWaffleMatrix.push_back(subMatrix); //AddMatrixPage(i, j, subMatrix); } AddMatrixPage(i, m_vecWaffleMatrix[i], m_vecSubWaffleMatrix); //for (int j = 0; j < m_vecWaffleMatrix[i].VecDieMatrixId.size(); j++) //{ // for (int k = 0; k < m_vecSubWaffleMatrix.size(); k++) // { // if (m_vecWaffleMatrix[i].VecDieMatrixId[j] == m_vecSubWaffleMatrix[k].MatrixId) // { // AddSubMatrixPage(i, m_vecSubWaffleMatrix[k],nullptr); // } // } //} } }