|
@@ -18,44 +18,97 @@ WaffleProgramPage::WaffleProgramPage(QWidget* parent)
|
|
|
|
|
|
|
|
|
|
ui.pushButtonSave->setProperty("type", "save");
|
|
ui.pushButtonSave->setProperty("type", "save");
|
|
-
|
|
|
|
- setStyleSheet("QGroupBox { border: 2px solid #A9B4FF;border-radius: 10px; }");
|
|
|
|
-
|
|
|
|
- //setStyleSheet(
|
|
|
|
- // "QPushButton{background-color: #A9B4FF;border-radius: 5px;height: 30px;}"
|
|
|
|
- // "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;}"
|
|
|
|
- // "QGroupBox{ border: 2px solid red}"
|
|
|
|
- // //"QGroupBox::title { subcontrol-origin: margin; subcontrol-position: top center; padding: 0 3px; }"
|
|
|
|
- //);
|
|
|
|
|
|
+ ui.pushButtonAddOutMatrix->setProperty("type", "addOutMatrix");
|
|
|
|
+ setStyleSheet(
|
|
|
|
+ "QWidget { background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #F1F4FD, stop: 1 #E5E4F6); }"
|
|
|
|
+ "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; }"
|
|
|
|
+
|
|
|
|
+ "QPushButton { background: #D0D0E8; border: 1px solid #BABBDC; border-radius: 6px; padding: 2px 5px; }" // Button background color
|
|
|
|
+ "QPushButton:hover { background-color: #B0B0D8; }" // Lighter color on hover
|
|
|
|
+ "QPushButton:pressed { background-color: #A0A0C8; }" // Darker color on press
|
|
|
|
+
|
|
|
|
+ );
|
|
|
|
|
|
m_manageDB = CManageDB::GetInstance();
|
|
m_manageDB = CManageDB::GetInstance();
|
|
if (m_manageDB == nullptr) return;
|
|
if (m_manageDB == nullptr) return;
|
|
m_pProduct = m_manageDB->GetCProduct();
|
|
m_pProduct = m_manageDB->GetCProduct();
|
|
if (m_pProduct == nullptr) return;
|
|
if (m_pProduct == nullptr) return;
|
|
|
|
|
|
|
|
+ m_pProgramCViewInterface = ns_module::CViewInterface::GetInstance();
|
|
|
|
+
|
|
initPage();
|
|
initPage();
|
|
|
|
|
|
connect(ui.pushButtonSave, &QPushButton::clicked, this, [=]() {
|
|
connect(ui.pushButtonSave, &QPushButton::clicked, this, [=]() {
|
|
m_pProduct->SetAllWaffleMatrix(m_vecWaffleMatrix);
|
|
m_pProduct->SetAllWaffleMatrix(m_vecWaffleMatrix);
|
|
m_pProduct->SetAllWaffleDieMatrix(m_vecSubWaffleMatrix);
|
|
m_pProduct->SetAllWaffleDieMatrix(m_vecSubWaffleMatrix);
|
|
|
|
|
|
|
|
+ CProduct* _Product = m_manageDB->GetCProduct();
|
|
});
|
|
});
|
|
|
|
|
|
-}
|
|
|
|
|
|
+ connect(ui.pushButtonAddOutMatrix, &QPushButton::clicked, this, [=]() {
|
|
|
|
+ PROGRAM_WAFFLE_MATRIX_STRUCT newMatrix;
|
|
|
|
+ //排序
|
|
|
|
+ std::sort(m_vecWaffleMatrix.begin(), m_vecWaffleMatrix.end(),
|
|
|
|
+ [](const PROGRAM_WAFFLE_MATRIX_STRUCT& a, const PROGRAM_WAFFLE_MATRIX_STRUCT& b) {
|
|
|
|
+ return a.MatrixId < b.MatrixId;
|
|
|
|
+ });
|
|
|
|
+ //找Id
|
|
|
|
+ int newId = 1;
|
|
|
|
+ for (const auto& matrix : m_vecWaffleMatrix)
|
|
|
|
+ {
|
|
|
|
+ if (matrix.MatrixId == newId)
|
|
|
|
+ {
|
|
|
|
+ newId++;
|
|
|
|
+ }
|
|
|
|
+ else if (matrix.MatrixId > newId)
|
|
|
|
+ {
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ newMatrix.MatrixId = newId;
|
|
|
|
+ newMatrix.PackRow = 0;
|
|
|
|
+ newMatrix.PackCol = 0;
|
|
|
|
+ int newVectorIndex = m_vecWaffleMatrix.size();
|
|
|
|
+ std::vector<PROGRAM_DIE_MATRIX_STRUCT> newVecSubMatrix;
|
|
|
|
+ m_vecWaffleMatrix.push_back(newMatrix);
|
|
|
|
+ AddMatrixPage(newVectorIndex, newMatrix, newVecSubMatrix);
|
|
|
|
|
|
|
|
+ });
|
|
|
|
+}
|
|
|
|
|
|
WaffleProgramPage::~WaffleProgramPage()
|
|
WaffleProgramPage::~WaffleProgramPage()
|
|
{
|
|
{
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+XY_DOUBLE_STRUCT WaffleProgramPage::WaffleGetAxisPosition(std::string ModuleType, XY_DOUBLE_STRUCT& pos)
|
|
|
|
+{
|
|
|
|
+ /*CAxis* _Axis;
|
|
|
|
+ CAxis::AXIS_TYPE eAxisType = _Axis->GetAxisType();*/
|
|
|
|
+ if (m_pProgramCViewInterface == nullptr)
|
|
|
|
+ {
|
|
|
|
+ XY_DOUBLE_STRUCT errorPt = pos; // 可以根据需要返回一个错误状态
|
|
|
|
+
|
|
|
|
+ // 弹出消息框显示位置
|
|
|
|
+ QString positionString = QString("Unable to retrieve axis position for module type: %1").arg(QString::fromStdString(ModuleType));
|
|
|
|
+ QMessageBox::information(this, "Axis Position Error", positionString);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ return errorPt;
|
|
|
|
+ }
|
|
|
|
+ m_pProgramCViewInterface->GetViewMotion()->GetAxisPosition(ModuleType, "X", pos.x);
|
|
|
|
+ m_pProgramCViewInterface->GetViewMotion()->GetAxisPosition(ModuleType, "Y", pos.y);
|
|
|
|
+
|
|
|
|
+ return pos;
|
|
|
|
+}
|
|
|
|
+
|
|
void WaffleProgramPage::AddMatrixPage(int vectorIndex, PROGRAM_WAFFLE_MATRIX_STRUCT matrixData, std::vector<PROGRAM_DIE_MATRIX_STRUCT> vecSubMatrix)
|
|
void WaffleProgramPage::AddMatrixPage(int vectorIndex, PROGRAM_WAFFLE_MATRIX_STRUCT matrixData, std::vector<PROGRAM_DIE_MATRIX_STRUCT> vecSubMatrix)
|
|
{
|
|
{
|
|
int matrixNum = m_mapSubMatrixControls.size();
|
|
int matrixNum = m_mapSubMatrixControls.size();
|
|
@@ -65,8 +118,9 @@ void WaffleProgramPage::AddMatrixPage(int vectorIndex, PROGRAM_WAFFLE_MATRIX_STR
|
|
QWidget* outWidget = new QWidget();
|
|
QWidget* outWidget = new QWidget();
|
|
|
|
|
|
QGridLayout* outMatrixGridLayout = new QGridLayout();
|
|
QGridLayout* outMatrixGridLayout = new QGridLayout();
|
|
- outMatrixGridLayout->setSpacing(6);
|
|
|
|
|
|
+ outMatrixGridLayout->setSpacing(4);
|
|
outMatrixGridLayout->setObjectName(QString::fromUtf8("Out GridLayout"));
|
|
outMatrixGridLayout->setObjectName(QString::fromUtf8("Out GridLayout"));
|
|
|
|
+ outMatrixGridLayout->setContentsMargins(0, 0, 0, 0); // 设置布局的边距为0
|
|
|
|
|
|
QGridLayout* boxGridLayout = new QGridLayout();
|
|
QGridLayout* boxGridLayout = new QGridLayout();
|
|
boxGridLayout->setSpacing(6);
|
|
boxGridLayout->setSpacing(6);
|
|
@@ -76,38 +130,12 @@ void WaffleProgramPage::AddMatrixPage(int vectorIndex, PROGRAM_WAFFLE_MATRIX_STR
|
|
QSpacerItem* item = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
|
QSpacerItem* item = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
|
buttonLayout->addSpacerItem(item);
|
|
buttonLayout->addSpacerItem(item);
|
|
|
|
|
|
- QPushButton* pushButtonAddOutMatrix = new QPushButton();
|
|
|
|
- pushButtonAddOutMatrix->setObjectName(QString::fromUtf8("button Add"));
|
|
|
|
- pushButtonAddOutMatrix->setText(tr("add out Matrix"));
|
|
|
|
- buttonLayout->addWidget(pushButtonAddOutMatrix);
|
|
|
|
|
|
+ //QPushButton* pushButtonAddOutMatrix = new QPushButton();
|
|
|
|
+ //pushButtonAddOutMatrix->setObjectName(QString::fromUtf8("button Add"));
|
|
|
|
+ //pushButtonAddOutMatrix->setText(tr("add out Matrix"));
|
|
|
|
+ //buttonLayout->addWidget(pushButtonAddOutMatrix);
|
|
|
|
|
|
- connect(pushButtonAddOutMatrix, &QPushButton::clicked, this, [=]() {
|
|
|
|
- PROGRAM_WAFFLE_MATRIX_STRUCT newMatrix;
|
|
|
|
- //排序
|
|
|
|
- std::sort(m_vecWaffleMatrix.begin(), m_vecWaffleMatrix.end(),
|
|
|
|
- [](const PROGRAM_WAFFLE_MATRIX_STRUCT& a, const PROGRAM_WAFFLE_MATRIX_STRUCT& b) {
|
|
|
|
- return a.MatrixId < b.MatrixId;
|
|
|
|
- });
|
|
|
|
- //找Id
|
|
|
|
- int newId = 1;
|
|
|
|
- for (const auto& matrix : m_vecWaffleMatrix)
|
|
|
|
- {
|
|
|
|
- if (matrix.MatrixId == newId)
|
|
|
|
- {
|
|
|
|
- newId++;
|
|
|
|
- } else if (matrix.MatrixId > newId)
|
|
|
|
- {
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- newMatrix.MatrixId = newId;
|
|
|
|
- int newVectorIndex = m_vecWaffleMatrix.size();
|
|
|
|
- std::vector<PROGRAM_DIE_MATRIX_STRUCT> newVecSubMatrix;
|
|
|
|
- m_vecWaffleMatrix.push_back(newMatrix);
|
|
|
|
- AddMatrixPage(newVectorIndex, newMatrix, newVecSubMatrix);
|
|
|
|
-
|
|
|
|
- });
|
|
|
|
|
|
+
|
|
|
|
|
|
//ui.verticalLayout->addLayout(buttonLayout);
|
|
//ui.verticalLayout->addLayout(buttonLayout);
|
|
|
|
|
|
@@ -122,14 +150,14 @@ void WaffleProgramPage::AddMatrixPage(int vectorIndex, PROGRAM_WAFFLE_MATRIX_STR
|
|
labelTitle->setObjectName(QString::fromUtf8("labelTitle"));
|
|
labelTitle->setObjectName(QString::fromUtf8("labelTitle"));
|
|
labelTitle->setText(tr("Matrix ") + QString::number(vectorIndex));
|
|
labelTitle->setText(tr("Matrix ") + QString::number(vectorIndex));
|
|
labelTitle->setStyleSheet("color: #6A78FF;height: 30px");
|
|
labelTitle->setStyleSheet("color: #6A78FF;height: 30px");
|
|
- matrixGridLayout->addWidget(labelTitle, 0, 1, 1, 3);
|
|
|
|
|
|
+ matrixGridLayout->addWidget(labelTitle, 0, 0, 1, 1);
|
|
vecControls.push_back(labelTitle);
|
|
vecControls.push_back(labelTitle);
|
|
|
|
|
|
|
|
|
|
QPushButton* pushButtonAdd = new QPushButton(outWidget);
|
|
QPushButton* pushButtonAdd = new QPushButton(outWidget);
|
|
pushButtonAdd->setObjectName(QString::fromUtf8("button Add"));
|
|
pushButtonAdd->setObjectName(QString::fromUtf8("button Add"));
|
|
- pushButtonAdd->setText(tr("add sub Matrix"));
|
|
|
|
- matrixGridLayout->addWidget(pushButtonAdd, 1, 1, 1, 1);
|
|
|
|
|
|
+ pushButtonAdd->setText(tr("Add sub Matrix"));
|
|
|
|
+ matrixGridLayout->addWidget(pushButtonAdd, 0, 2, 1, 2);
|
|
pushButtonAdd->setProperty("type", "default");
|
|
pushButtonAdd->setProperty("type", "default");
|
|
|
|
|
|
connect(pushButtonAdd, &QPushButton::clicked, this, [=]() {
|
|
connect(pushButtonAdd, &QPushButton::clicked, this, [=]() {
|
|
@@ -156,6 +184,8 @@ void WaffleProgramPage::AddMatrixPage(int vectorIndex, PROGRAM_WAFFLE_MATRIX_STR
|
|
dieMatrix.MatrixId = newId;
|
|
dieMatrix.MatrixId = newId;
|
|
dieMatrix.strModuleName = "WaffleHead";
|
|
dieMatrix.strModuleName = "WaffleHead";
|
|
dieMatrix.iModuleId = MODULE_LIST::WaffleHead;
|
|
dieMatrix.iModuleId = MODULE_LIST::WaffleHead;
|
|
|
|
+ dieMatrix.MatrixRow = 0;
|
|
|
|
+ dieMatrix.MatrixCol = 0;
|
|
m_vecSubWaffleMatrix.push_back(dieMatrix);
|
|
m_vecSubWaffleMatrix.push_back(dieMatrix);
|
|
|
|
|
|
//找大矩阵ID/Index
|
|
//找大矩阵ID/Index
|
|
@@ -163,14 +193,14 @@ void WaffleProgramPage::AddMatrixPage(int vectorIndex, PROGRAM_WAFFLE_MATRIX_STR
|
|
int index = currentIt.value(); //迭代器 erase后currentIt被删除了
|
|
int index = currentIt.value(); //迭代器 erase后currentIt被删除了
|
|
m_vecWaffleMatrix[index].VecDieMatrixId.push_back(newId);
|
|
m_vecWaffleMatrix[index].VecDieMatrixId.push_back(newId);
|
|
|
|
|
|
- AddSubMatrixPage(newIndex, dieMatrix, boxGridLayout);
|
|
|
|
|
|
+ AddSubMatrixPage(vectorIndex,newIndex, dieMatrix, boxGridLayout);
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
QPushButton* pushButtonDelete = new QPushButton(outWidget);
|
|
QPushButton* pushButtonDelete = new QPushButton(outWidget);
|
|
pushButtonDelete->setObjectName(QString::fromUtf8("button delete"));
|
|
pushButtonDelete->setObjectName(QString::fromUtf8("button delete"));
|
|
- pushButtonDelete->setText(tr("delete Matrix"));
|
|
|
|
- matrixGridLayout->addWidget(pushButtonDelete, 1, 2, 1, 1);
|
|
|
|
|
|
+ pushButtonDelete->setText(tr("Delete"));
|
|
|
|
+ matrixGridLayout->addWidget(pushButtonDelete, 0, 1, 1, 1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -199,24 +229,26 @@ void WaffleProgramPage::AddMatrixPage(int vectorIndex, PROGRAM_WAFFLE_MATRIX_STR
|
|
|
|
|
|
QLabel* labelRow = new QLabel(outWidget);
|
|
QLabel* labelRow = new QLabel(outWidget);
|
|
labelRow->setObjectName(QString::fromUtf8("labelRow"));
|
|
labelRow->setObjectName(QString::fromUtf8("labelRow"));
|
|
- labelRow->setText(tr("Row "));
|
|
|
|
|
|
+ labelRow->setText(tr("Row & Cow"));
|
|
matrixGridLayout->addWidget(labelRow, 2, 0, 1, 1);
|
|
matrixGridLayout->addWidget(labelRow, 2, 0, 1, 1);
|
|
vecControls.push_back(labelRow);
|
|
vecControls.push_back(labelRow);
|
|
|
|
|
|
SpinBox* spinBoxRow = new SpinBox(outWidget);
|
|
SpinBox* spinBoxRow = new SpinBox(outWidget);
|
|
spinBoxRow->setObjectName(QString::fromUtf8("spinBoxRow"));
|
|
spinBoxRow->setObjectName(QString::fromUtf8("spinBoxRow"));
|
|
|
|
+ spinBoxRow->setFixedWidth(100); // Set fixed width to 100
|
|
matrixGridLayout->addWidget(spinBoxRow, 2, 1, 1, 1);
|
|
matrixGridLayout->addWidget(spinBoxRow, 2, 1, 1, 1);
|
|
vecControls.push_back(spinBoxRow);
|
|
vecControls.push_back(spinBoxRow);
|
|
|
|
|
|
- QLabel* labelCol = new QLabel(outWidget);
|
|
|
|
|
|
+ /*QLabel* labelCol = new QLabel(outWidget);
|
|
labelCol->setObjectName(QString::fromUtf8("labelCol"));
|
|
labelCol->setObjectName(QString::fromUtf8("labelCol"));
|
|
labelCol->setText(tr("Cow "));
|
|
labelCol->setText(tr("Cow "));
|
|
matrixGridLayout->addWidget(labelCol, 3, 0, 1, 1);
|
|
matrixGridLayout->addWidget(labelCol, 3, 0, 1, 1);
|
|
- vecControls.push_back(labelCol);
|
|
|
|
|
|
+ vecControls.push_back(labelCol);*/
|
|
|
|
|
|
SpinBox* spinBoxCol = new SpinBox(outWidget);
|
|
SpinBox* spinBoxCol = new SpinBox(outWidget);
|
|
spinBoxCol->setObjectName(QString::fromUtf8("spinBoxCol"));
|
|
spinBoxCol->setObjectName(QString::fromUtf8("spinBoxCol"));
|
|
- matrixGridLayout->addWidget(spinBoxCol, 3, 1, 1, 1);
|
|
|
|
|
|
+ spinBoxCol->setFixedWidth(100); // Set fixed width to 100
|
|
|
|
+ matrixGridLayout->addWidget(spinBoxCol, 2, 2, 1, 1);
|
|
vecControls.push_back(spinBoxCol);
|
|
vecControls.push_back(spinBoxCol);
|
|
|
|
|
|
QLabel* labelLeftTop = new QLabel(outWidget);
|
|
QLabel* labelLeftTop = new QLabel(outWidget);
|
|
@@ -227,14 +259,25 @@ void WaffleProgramPage::AddMatrixPage(int vectorIndex, PROGRAM_WAFFLE_MATRIX_STR
|
|
|
|
|
|
DoubleSpinBox* doubleSpinBoxLeftTopX = new DoubleSpinBox(outWidget);
|
|
DoubleSpinBox* doubleSpinBoxLeftTopX = new DoubleSpinBox(outWidget);
|
|
doubleSpinBoxLeftTopX->setObjectName(QString::fromUtf8("doubleSpinBoxLeftTopX"));
|
|
doubleSpinBoxLeftTopX->setObjectName(QString::fromUtf8("doubleSpinBoxLeftTopX"));
|
|
|
|
+ doubleSpinBoxLeftTopX->setFixedWidth(100); // Set fixed width to 100
|
|
matrixGridLayout->addWidget(doubleSpinBoxLeftTopX, 4, 1, 1, 1);
|
|
matrixGridLayout->addWidget(doubleSpinBoxLeftTopX, 4, 1, 1, 1);
|
|
vecControls.push_back(doubleSpinBoxLeftTopX);
|
|
vecControls.push_back(doubleSpinBoxLeftTopX);
|
|
|
|
|
|
DoubleSpinBox* doubleSpinBoxLeftTopY = new DoubleSpinBox(outWidget);
|
|
DoubleSpinBox* doubleSpinBoxLeftTopY = new DoubleSpinBox(outWidget);
|
|
doubleSpinBoxLeftTopY->setObjectName(QString::fromUtf8("doubleSpinBoxLeftTopY"));
|
|
doubleSpinBoxLeftTopY->setObjectName(QString::fromUtf8("doubleSpinBoxLeftTopY"));
|
|
|
|
+ doubleSpinBoxLeftTopY->setFixedWidth(100); // Set fixed width to 100
|
|
matrixGridLayout->addWidget(doubleSpinBoxLeftTopY, 4, 2, 1, 1);
|
|
matrixGridLayout->addWidget(doubleSpinBoxLeftTopY, 4, 2, 1, 1);
|
|
vecControls.push_back(doubleSpinBoxLeftTopY);
|
|
vecControls.push_back(doubleSpinBoxLeftTopY);
|
|
|
|
|
|
|
|
+ QPushButton* buttonLeftTop = new QPushButton("Get Pos", this);
|
|
|
|
+ buttonLeftTop->setFixedWidth(62); // Set the same width for the button
|
|
|
|
+ matrixGridLayout->addWidget(buttonLeftTop, 4, 3, 1, 1); // Position the button next to LeftTopPos
|
|
|
|
+ connect(buttonLeftTop, &QPushButton::clicked, this, [=]() {
|
|
|
|
+ XY_DOUBLE_STRUCT position = WaffleGetAxisPosition("WaffleHead", m_vecWaffleMatrix[vectorIndex].LeftTopPoint);
|
|
|
|
+ doubleSpinBoxLeftTopX->setValue(position.x); // Update X axis
|
|
|
|
+ doubleSpinBoxLeftTopY->setValue(position.y); // Update Y axis
|
|
|
|
+ });
|
|
|
|
+
|
|
QLabel* labelRightTopPos = new QLabel(outWidget);
|
|
QLabel* labelRightTopPos = new QLabel(outWidget);
|
|
labelRightTopPos->setObjectName(QString::fromUtf8("labelRightTopPos"));
|
|
labelRightTopPos->setObjectName(QString::fromUtf8("labelRightTopPos"));
|
|
labelRightTopPos->setText(tr("Right Top Pos "));
|
|
labelRightTopPos->setText(tr("Right Top Pos "));
|
|
@@ -243,14 +286,25 @@ void WaffleProgramPage::AddMatrixPage(int vectorIndex, PROGRAM_WAFFLE_MATRIX_STR
|
|
|
|
|
|
DoubleSpinBox* doubleSpinBoxRightTopX = new DoubleSpinBox(outWidget);
|
|
DoubleSpinBox* doubleSpinBoxRightTopX = new DoubleSpinBox(outWidget);
|
|
doubleSpinBoxRightTopX->setObjectName(QString::fromUtf8("doubleSpinBoxRightTopX"));
|
|
doubleSpinBoxRightTopX->setObjectName(QString::fromUtf8("doubleSpinBoxRightTopX"));
|
|
|
|
+ doubleSpinBoxRightTopX->setFixedWidth(100); // Set fixed width to 100
|
|
matrixGridLayout->addWidget(doubleSpinBoxRightTopX, 5, 1, 1, 1);
|
|
matrixGridLayout->addWidget(doubleSpinBoxRightTopX, 5, 1, 1, 1);
|
|
vecControls.push_back(doubleSpinBoxRightTopX);
|
|
vecControls.push_back(doubleSpinBoxRightTopX);
|
|
|
|
|
|
DoubleSpinBox* doubleSpinBoxRightTopY = new DoubleSpinBox(outWidget);
|
|
DoubleSpinBox* doubleSpinBoxRightTopY = new DoubleSpinBox(outWidget);
|
|
doubleSpinBoxRightTopY->setObjectName(QString::fromUtf8("doubleSpinBoxRightTopY"));
|
|
doubleSpinBoxRightTopY->setObjectName(QString::fromUtf8("doubleSpinBoxRightTopY"));
|
|
|
|
+ doubleSpinBoxRightTopY->setFixedWidth(100); // Set fixed width to 100
|
|
matrixGridLayout->addWidget(doubleSpinBoxRightTopY, 5, 2, 1, 1);
|
|
matrixGridLayout->addWidget(doubleSpinBoxRightTopY, 5, 2, 1, 1);
|
|
vecControls.push_back(doubleSpinBoxRightTopY);
|
|
vecControls.push_back(doubleSpinBoxRightTopY);
|
|
|
|
|
|
|
|
+ QPushButton* buttonRightTop = new QPushButton("Get Pos", this);
|
|
|
|
+ buttonRightTop->setFixedWidth(62); // Set the same width for the button
|
|
|
|
+ matrixGridLayout->addWidget(buttonRightTop, 5, 3, 1, 1); // Position the button next to RightTopPos
|
|
|
|
+ connect(buttonRightTop, &QPushButton::clicked, this, [=]() {
|
|
|
|
+ XY_DOUBLE_STRUCT position = WaffleGetAxisPosition("WaffleHead", m_vecWaffleMatrix[vectorIndex].LeftTopPoint);
|
|
|
|
+ doubleSpinBoxRightTopX->setValue(position.x); // Update X axis
|
|
|
|
+ doubleSpinBoxRightTopY->setValue(position.y); // Update Y axis
|
|
|
|
+ });
|
|
|
|
+
|
|
QLabel* labelRightButtomPos = new QLabel(outWidget);
|
|
QLabel* labelRightButtomPos = new QLabel(outWidget);
|
|
labelRightButtomPos->setObjectName(QString::fromUtf8("labelRightButtomPos"));
|
|
labelRightButtomPos->setObjectName(QString::fromUtf8("labelRightButtomPos"));
|
|
labelRightButtomPos->setText(tr("Right Buttom pos"));
|
|
labelRightButtomPos->setText(tr("Right Buttom pos"));
|
|
@@ -259,14 +313,25 @@ void WaffleProgramPage::AddMatrixPage(int vectorIndex, PROGRAM_WAFFLE_MATRIX_STR
|
|
|
|
|
|
DoubleSpinBox* doubleSpinBoxRightButtomX = new DoubleSpinBox(outWidget);
|
|
DoubleSpinBox* doubleSpinBoxRightButtomX = new DoubleSpinBox(outWidget);
|
|
doubleSpinBoxRightButtomX->setObjectName(QString::fromUtf8("doubleSpinBoxRightButtomX"));
|
|
doubleSpinBoxRightButtomX->setObjectName(QString::fromUtf8("doubleSpinBoxRightButtomX"));
|
|
|
|
+ doubleSpinBoxRightButtomX->setFixedWidth(100); // Set fixed width to 100
|
|
matrixGridLayout->addWidget(doubleSpinBoxRightButtomX, 6, 1, 1, 1);
|
|
matrixGridLayout->addWidget(doubleSpinBoxRightButtomX, 6, 1, 1, 1);
|
|
vecControls.push_back(doubleSpinBoxRightButtomX);
|
|
vecControls.push_back(doubleSpinBoxRightButtomX);
|
|
|
|
|
|
DoubleSpinBox* doubleSpinBoxRightButtomY = new DoubleSpinBox(outWidget);
|
|
DoubleSpinBox* doubleSpinBoxRightButtomY = new DoubleSpinBox(outWidget);
|
|
doubleSpinBoxRightButtomY->setObjectName(QString::fromUtf8("doubleSpinBoxRightButtomY"));
|
|
doubleSpinBoxRightButtomY->setObjectName(QString::fromUtf8("doubleSpinBoxRightButtomY"));
|
|
|
|
+ doubleSpinBoxRightButtomY->setFixedWidth(100); // Set fixed width to 100
|
|
matrixGridLayout->addWidget(doubleSpinBoxRightButtomY, 6, 2, 1, 1);
|
|
matrixGridLayout->addWidget(doubleSpinBoxRightButtomY, 6, 2, 1, 1);
|
|
vecControls.push_back(doubleSpinBoxRightTopX);
|
|
vecControls.push_back(doubleSpinBoxRightTopX);
|
|
|
|
|
|
|
|
+ QPushButton* buttonRightButtom = new QPushButton("Get Pos", this);
|
|
|
|
+ buttonRightButtom->setFixedWidth(62); // Set the same width for the button
|
|
|
|
+ matrixGridLayout->addWidget(buttonRightButtom, 6, 3, 1, 1); // Position the button next to RightBottomPos
|
|
|
|
+ connect(buttonRightButtom, &QPushButton::clicked, this, [=]() {
|
|
|
|
+ XY_DOUBLE_STRUCT position = WaffleGetAxisPosition("WaffleHead", m_vecWaffleMatrix[vectorIndex].LeftTopPoint);
|
|
|
|
+ doubleSpinBoxRightButtomX->setValue(position.x); // Update X axis
|
|
|
|
+ doubleSpinBoxRightButtomY->setValue(position.y); // Update Y axis
|
|
|
|
+ });
|
|
|
|
+
|
|
QLabel* labelNoBondPts = new QLabel(outWidget);
|
|
QLabel* labelNoBondPts = new QLabel(outWidget);
|
|
labelNoBondPts->setObjectName(QString::fromUtf8("labelNoBondPts"));
|
|
labelNoBondPts->setObjectName(QString::fromUtf8("labelNoBondPts"));
|
|
labelNoBondPts->setText(tr("No Bond Points"));
|
|
labelNoBondPts->setText(tr("No Bond Points"));
|
|
@@ -275,12 +340,13 @@ void WaffleProgramPage::AddMatrixPage(int vectorIndex, PROGRAM_WAFFLE_MATRIX_STR
|
|
|
|
|
|
QLineEdit* lineEditNoBondPts = new QLineEdit(outWidget);
|
|
QLineEdit* lineEditNoBondPts = new QLineEdit(outWidget);
|
|
lineEditNoBondPts->setObjectName(QString::fromUtf8("lineEditNoBondPts"));
|
|
lineEditNoBondPts->setObjectName(QString::fromUtf8("lineEditNoBondPts"));
|
|
- matrixGridLayout->addWidget(lineEditNoBondPts, 7, 1, 1, 2);
|
|
|
|
|
|
+ matrixGridLayout->addWidget(lineEditNoBondPts, 7, 1, 1, 3);
|
|
vecControls.push_back(lineEditNoBondPts);
|
|
vecControls.push_back(lineEditNoBondPts);
|
|
|
|
|
|
lineEditNoBondPts->setReadOnly(true);
|
|
lineEditNoBondPts->setReadOnly(true);
|
|
lineEditNoBondPts->setCursor(Qt::PointingHandCursor);
|
|
lineEditNoBondPts->setCursor(Qt::PointingHandCursor);
|
|
- lineEditNoBondPts->setProperty("subVectorIndex", vectorIndex); // 存储索引
|
|
|
|
|
|
+ lineEditNoBondPts->setProperty("vectorIndex", vectorIndex); // 存储索引
|
|
|
|
+ lineEditNoBondPts->setProperty("parentMatrixIndex", -1); // 存储大矩阵的索引(即父矩阵)
|
|
lineEditNoBondPts->installEventFilter(this);
|
|
lineEditNoBondPts->installEventFilter(this);
|
|
|
|
|
|
QFrame* line = new QFrame(outWidget);
|
|
QFrame* line = new QFrame(outWidget);
|
|
@@ -307,7 +373,7 @@ void WaffleProgramPage::AddMatrixPage(int vectorIndex, PROGRAM_WAFFLE_MATRIX_STR
|
|
{
|
|
{
|
|
if (matrixData.VecDieMatrixId[j] == m_vecSubWaffleMatrix[i].MatrixId)
|
|
if (matrixData.VecDieMatrixId[j] == m_vecSubWaffleMatrix[i].MatrixId)
|
|
{
|
|
{
|
|
- AddSubMatrixPage(i, m_vecSubWaffleMatrix[i], boxGridLayout);
|
|
|
|
|
|
+ AddSubMatrixPage(j,i, m_vecSubWaffleMatrix[i], boxGridLayout);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -368,30 +434,31 @@ void WaffleProgramPage::AddMatrixPage(int vectorIndex, PROGRAM_WAFFLE_MATRIX_STR
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-void WaffleProgramPage::AddSubMatrixPage(int subVectorIndex, PROGRAM_DIE_MATRIX_STRUCT subMatrix, QGridLayout* layout)
|
|
|
|
|
|
+void WaffleProgramPage::AddSubMatrixPage(int vectorIndex, int subVectorIndex, PROGRAM_DIE_MATRIX_STRUCT subMatrix, QGridLayout* layout)
|
|
{
|
|
{
|
|
QVector<QObject*> vecControls;
|
|
QVector<QObject*> vecControls;
|
|
|
|
|
|
QWidget* subWidget = new QWidget();
|
|
QWidget* subWidget = new QWidget();
|
|
|
|
|
|
QGridLayout* subGridLayout = new QGridLayout(subWidget);
|
|
QGridLayout* subGridLayout = new QGridLayout(subWidget);
|
|
- subGridLayout->setSpacing(6);
|
|
|
|
|
|
+ subGridLayout->setSpacing(4);
|
|
subGridLayout->setObjectName(QString::fromUtf8("subGridLayout"));
|
|
subGridLayout->setObjectName(QString::fromUtf8("subGridLayout"));
|
|
//groupBox->setLayout(subGridLayout);
|
|
//groupBox->setLayout(subGridLayout);
|
|
-
|
|
|
|
|
|
+ subGridLayout->setContentsMargins(0, 0, 0, 0); // 设置布局的边距为0
|
|
|
|
+ subGridLayout->setAlignment(Qt::AlignCenter);
|
|
|
|
|
|
QLabel* labelTitle = new QLabel(subWidget);
|
|
QLabel* labelTitle = new QLabel(subWidget);
|
|
labelTitle->setObjectName(QString::fromUtf8("labelTitle"));
|
|
labelTitle->setObjectName(QString::fromUtf8("labelTitle"));
|
|
labelTitle->setText(tr("Sub Matrix ") + QString::number(subVectorIndex));
|
|
labelTitle->setText(tr("Sub Matrix ") + QString::number(subVectorIndex));
|
|
labelTitle->setStyleSheet("color: #808BFF;height: 30px");
|
|
labelTitle->setStyleSheet("color: #808BFF;height: 30px");
|
|
- subGridLayout->addWidget(labelTitle, 0, 1, 1, 3);
|
|
|
|
|
|
+ subGridLayout->addWidget(labelTitle, 0, 1, 1, 1);
|
|
vecControls.push_back(labelTitle);
|
|
vecControls.push_back(labelTitle);
|
|
|
|
|
|
|
|
|
|
QPushButton* pushButtonDelete = new QPushButton(subWidget);
|
|
QPushButton* pushButtonDelete = new QPushButton(subWidget);
|
|
pushButtonDelete->setObjectName(QString::fromUtf8("button delete"));
|
|
pushButtonDelete->setObjectName(QString::fromUtf8("button delete"));
|
|
- pushButtonDelete->setText(tr("delete Matrix"));
|
|
|
|
- subGridLayout->addWidget(pushButtonDelete, 1, 2, 1, 1);
|
|
|
|
|
|
+ pushButtonDelete->setText(tr("Delete"));
|
|
|
|
+ subGridLayout->addWidget(pushButtonDelete, 0, 3, 1, 1);
|
|
|
|
|
|
connect(pushButtonDelete, &QPushButton::clicked, this, [=]() {
|
|
connect(pushButtonDelete, &QPushButton::clicked, this, [=]() {
|
|
|
|
|
|
@@ -432,7 +499,7 @@ void WaffleProgramPage::AddSubMatrixPage(int subVectorIndex, PROGRAM_DIE_MATRIX_
|
|
|
|
|
|
QLabel* labelRow = new QLabel(subWidget);
|
|
QLabel* labelRow = new QLabel(subWidget);
|
|
labelRow->setObjectName(QString::fromUtf8("labelRow"));
|
|
labelRow->setObjectName(QString::fromUtf8("labelRow"));
|
|
- labelRow->setText(tr("Row "));
|
|
|
|
|
|
+ labelRow->setText(tr("Row & Cow"));
|
|
subGridLayout->addWidget(labelRow, 2, 0, 1, 1);
|
|
subGridLayout->addWidget(labelRow, 2, 0, 1, 1);
|
|
vecControls.push_back(labelRow);
|
|
vecControls.push_back(labelRow);
|
|
|
|
|
|
@@ -441,15 +508,15 @@ void WaffleProgramPage::AddSubMatrixPage(int subVectorIndex, PROGRAM_DIE_MATRIX_
|
|
subGridLayout->addWidget(spinBoxRow, 2, 1, 1, 1);
|
|
subGridLayout->addWidget(spinBoxRow, 2, 1, 1, 1);
|
|
vecControls.push_back(spinBoxRow);
|
|
vecControls.push_back(spinBoxRow);
|
|
|
|
|
|
- QLabel* labelCol = new QLabel(subWidget);
|
|
|
|
|
|
+ /*QLabel* labelCol = new QLabel(subWidget);
|
|
labelCol->setObjectName(QString::fromUtf8("labelCol"));
|
|
labelCol->setObjectName(QString::fromUtf8("labelCol"));
|
|
labelCol->setText(tr("Cow "));
|
|
labelCol->setText(tr("Cow "));
|
|
subGridLayout->addWidget(labelCol, 3, 0, 1, 1);
|
|
subGridLayout->addWidget(labelCol, 3, 0, 1, 1);
|
|
- vecControls.push_back(labelCol);
|
|
|
|
|
|
+ vecControls.push_back(labelCol);*/
|
|
|
|
|
|
SpinBox* spinBoxCol = new SpinBox(subWidget);
|
|
SpinBox* spinBoxCol = new SpinBox(subWidget);
|
|
spinBoxCol->setObjectName(QString::fromUtf8("spinBoxCol"));
|
|
spinBoxCol->setObjectName(QString::fromUtf8("spinBoxCol"));
|
|
- subGridLayout->addWidget(spinBoxCol, 3, 1, 1, 1);
|
|
|
|
|
|
+ subGridLayout->addWidget(spinBoxCol, 2, 2, 1, 1);
|
|
vecControls.push_back(spinBoxCol);
|
|
vecControls.push_back(spinBoxCol);
|
|
|
|
|
|
QLabel* labelLeftTop = new QLabel(subWidget);
|
|
QLabel* labelLeftTop = new QLabel(subWidget);
|
|
@@ -460,11 +527,15 @@ void WaffleProgramPage::AddSubMatrixPage(int subVectorIndex, PROGRAM_DIE_MATRIX_
|
|
|
|
|
|
DoubleSpinBox* doubleSpinBoxLeftTopX = new DoubleSpinBox(subWidget);
|
|
DoubleSpinBox* doubleSpinBoxLeftTopX = new DoubleSpinBox(subWidget);
|
|
doubleSpinBoxLeftTopX->setObjectName(QString::fromUtf8("doubleSpinBoxLeftTopX"));
|
|
doubleSpinBoxLeftTopX->setObjectName(QString::fromUtf8("doubleSpinBoxLeftTopX"));
|
|
|
|
+ doubleSpinBoxLeftTopX->setFixedWidth(100); // Set fixed width to 100
|
|
|
|
+ doubleSpinBoxLeftTopX->setFixedWidth(100); // Set fixed width to 100
|
|
subGridLayout->addWidget(doubleSpinBoxLeftTopX, 4, 1, 1, 1);
|
|
subGridLayout->addWidget(doubleSpinBoxLeftTopX, 4, 1, 1, 1);
|
|
vecControls.push_back(doubleSpinBoxLeftTopX);
|
|
vecControls.push_back(doubleSpinBoxLeftTopX);
|
|
|
|
|
|
DoubleSpinBox* doubleSpinBoxLeftTopY = new DoubleSpinBox(subWidget);
|
|
DoubleSpinBox* doubleSpinBoxLeftTopY = new DoubleSpinBox(subWidget);
|
|
doubleSpinBoxLeftTopY->setObjectName(QString::fromUtf8("doubleSpinBoxLeftTopY"));
|
|
doubleSpinBoxLeftTopY->setObjectName(QString::fromUtf8("doubleSpinBoxLeftTopY"));
|
|
|
|
+ doubleSpinBoxLeftTopY->setFixedWidth(100); // Set fixed width to 100
|
|
|
|
+ doubleSpinBoxLeftTopY->setFixedWidth(100); // Set fixed width to 100
|
|
subGridLayout->addWidget(doubleSpinBoxLeftTopY, 4, 2, 1, 1);
|
|
subGridLayout->addWidget(doubleSpinBoxLeftTopY, 4, 2, 1, 1);
|
|
vecControls.push_back(doubleSpinBoxLeftTopY);
|
|
vecControls.push_back(doubleSpinBoxLeftTopY);
|
|
|
|
|
|
@@ -476,11 +547,13 @@ void WaffleProgramPage::AddSubMatrixPage(int subVectorIndex, PROGRAM_DIE_MATRIX_
|
|
|
|
|
|
DoubleSpinBox* doubleSpinBoxRightTopX = new DoubleSpinBox(subWidget);
|
|
DoubleSpinBox* doubleSpinBoxRightTopX = new DoubleSpinBox(subWidget);
|
|
doubleSpinBoxRightTopX->setObjectName(QString::fromUtf8("doubleSpinBoxRightTopX"));
|
|
doubleSpinBoxRightTopX->setObjectName(QString::fromUtf8("doubleSpinBoxRightTopX"));
|
|
|
|
+ doubleSpinBoxRightTopX->setFixedWidth(100); // Set fixed width to 100
|
|
subGridLayout->addWidget(doubleSpinBoxRightTopX, 5, 1, 1, 1);
|
|
subGridLayout->addWidget(doubleSpinBoxRightTopX, 5, 1, 1, 1);
|
|
vecControls.push_back(doubleSpinBoxRightTopX);
|
|
vecControls.push_back(doubleSpinBoxRightTopX);
|
|
|
|
|
|
DoubleSpinBox* doubleSpinBoxRightTopY = new DoubleSpinBox(subWidget);
|
|
DoubleSpinBox* doubleSpinBoxRightTopY = new DoubleSpinBox(subWidget);
|
|
doubleSpinBoxRightTopY->setObjectName(QString::fromUtf8("doubleSpinBoxRightTopY"));
|
|
doubleSpinBoxRightTopY->setObjectName(QString::fromUtf8("doubleSpinBoxRightTopY"));
|
|
|
|
+ doubleSpinBoxRightTopY->setFixedWidth(100); // Set fixed width to 100
|
|
subGridLayout->addWidget(doubleSpinBoxRightTopY, 5, 2, 1, 1);
|
|
subGridLayout->addWidget(doubleSpinBoxRightTopY, 5, 2, 1, 1);
|
|
vecControls.push_back(doubleSpinBoxRightTopY);
|
|
vecControls.push_back(doubleSpinBoxRightTopY);
|
|
|
|
|
|
@@ -492,11 +565,13 @@ void WaffleProgramPage::AddSubMatrixPage(int subVectorIndex, PROGRAM_DIE_MATRIX_
|
|
|
|
|
|
DoubleSpinBox* doubleSpinBoxRightButtomX = new DoubleSpinBox(subWidget);
|
|
DoubleSpinBox* doubleSpinBoxRightButtomX = new DoubleSpinBox(subWidget);
|
|
doubleSpinBoxRightButtomX->setObjectName(QString::fromUtf8("doubleSpinBoxRightButtomX"));
|
|
doubleSpinBoxRightButtomX->setObjectName(QString::fromUtf8("doubleSpinBoxRightButtomX"));
|
|
|
|
+ doubleSpinBoxRightButtomX->setFixedWidth(100); // Set fixed width to 100
|
|
subGridLayout->addWidget(doubleSpinBoxRightButtomX, 6, 1, 1, 1);
|
|
subGridLayout->addWidget(doubleSpinBoxRightButtomX, 6, 1, 1, 1);
|
|
vecControls.push_back(doubleSpinBoxRightButtomX);
|
|
vecControls.push_back(doubleSpinBoxRightButtomX);
|
|
|
|
|
|
DoubleSpinBox* doubleSpinBoxRightButtomY = new DoubleSpinBox(subWidget);
|
|
DoubleSpinBox* doubleSpinBoxRightButtomY = new DoubleSpinBox(subWidget);
|
|
doubleSpinBoxRightButtomY->setObjectName(QString::fromUtf8("doubleSpinBoxRightButtomY"));
|
|
doubleSpinBoxRightButtomY->setObjectName(QString::fromUtf8("doubleSpinBoxRightButtomY"));
|
|
|
|
+ doubleSpinBoxRightButtomY->setFixedWidth(100); // Set fixed width to 100
|
|
subGridLayout->addWidget(doubleSpinBoxRightButtomY, 6, 2, 1, 1);
|
|
subGridLayout->addWidget(doubleSpinBoxRightButtomY, 6, 2, 1, 1);
|
|
vecControls.push_back(doubleSpinBoxRightTopX);
|
|
vecControls.push_back(doubleSpinBoxRightTopX);
|
|
|
|
|
|
@@ -510,13 +585,48 @@ void WaffleProgramPage::AddSubMatrixPage(int subVectorIndex, PROGRAM_DIE_MATRIX_
|
|
lineEditNoBondPts->setObjectName(QString::fromUtf8("lineEditNoBondPts"));
|
|
lineEditNoBondPts->setObjectName(QString::fromUtf8("lineEditNoBondPts"));
|
|
|
|
|
|
lineEditNoBondPts->setReadOnly(true);
|
|
lineEditNoBondPts->setReadOnly(true);
|
|
- lineEditNoBondPts->setCursor(Qt::PointingHandCursor);
|
|
|
|
- lineEditNoBondPts->setProperty("vectorIndex", subVectorIndex); // 存储索引
|
|
|
|
|
|
+ lineEditNoBondPts->setCursor(Qt::PointingHandCursor);
|
|
|
|
+ //lineEditNoBondPts->setProperty("matrixType", "SubMatrix"); // 设置为子矩阵
|
|
|
|
+ lineEditNoBondPts->setProperty("vectorIndex", subVectorIndex); // 子矩阵索引
|
|
|
|
+ lineEditNoBondPts->setProperty("parentMatrixIndex", vectorIndex); // 设置父矩阵的索引
|
|
|
|
+
|
|
lineEditNoBondPts->installEventFilter(this);
|
|
lineEditNoBondPts->installEventFilter(this);
|
|
|
|
|
|
- subGridLayout->addWidget(lineEditNoBondPts, 7, 1, 1, 2);
|
|
|
|
|
|
+ subGridLayout->addWidget(lineEditNoBondPts, 7, 1, 1, 3);
|
|
vecControls.push_back(lineEditNoBondPts);
|
|
vecControls.push_back(lineEditNoBondPts);
|
|
|
|
|
|
|
|
+ // Left Top Position X and Y
|
|
|
|
+ QPushButton* buttonLeftTop = new QPushButton("Get Pos", subWidget);
|
|
|
|
+ buttonLeftTop->setFixedWidth(62); // 设置固定宽度
|
|
|
|
+ subGridLayout->addWidget(buttonLeftTop, 4, 3, 1, 1); // 添加按钮到4行3列
|
|
|
|
+
|
|
|
|
+ connect(buttonLeftTop, &QPushButton::clicked, this, [=]() {
|
|
|
|
+ XY_DOUBLE_STRUCT position = WaffleGetAxisPosition("WaffleHead", m_vecWaffleMatrix[subVectorIndex].LeftTopPoint);
|
|
|
|
+ doubleSpinBoxLeftTopX->setValue(position.x); // 更新 X 轴
|
|
|
|
+ doubleSpinBoxLeftTopY->setValue(position.y); // 更新 Y 轴
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ // Right Top Position X and Y
|
|
|
|
+ QPushButton* buttonRightTop = new QPushButton("Get Pos", subWidget);
|
|
|
|
+ buttonRightTop->setFixedWidth(62); // 设置固定宽度
|
|
|
|
+ subGridLayout->addWidget(buttonRightTop, 5, 3, 1, 1); // 添加按钮到5行3列
|
|
|
|
+
|
|
|
|
+ connect(buttonRightTop, &QPushButton::clicked, this, [=]() {
|
|
|
|
+ XY_DOUBLE_STRUCT position = WaffleGetAxisPosition("WaffleHead", m_vecWaffleMatrix[subVectorIndex].RightTopPoint);
|
|
|
|
+ doubleSpinBoxRightTopX->setValue(position.x); // 更新 X 轴
|
|
|
|
+ doubleSpinBoxRightTopY->setValue(position.y); // 更新 Y 轴
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ // Right Bottom Position X and Y
|
|
|
|
+ QPushButton* buttonRightButtom = new QPushButton("Get Pos", subWidget);
|
|
|
|
+ buttonRightButtom->setFixedWidth(62); // 设置固定宽度
|
|
|
|
+ subGridLayout->addWidget(buttonRightButtom, 6, 3, 1, 1); // 添加按钮到6行3列
|
|
|
|
+
|
|
|
|
+ connect(buttonRightButtom, &QPushButton::clicked, this, [=]() {
|
|
|
|
+ XY_DOUBLE_STRUCT position = WaffleGetAxisPosition("WaffleHead", m_vecWaffleMatrix[subVectorIndex].RightBottomPoint);
|
|
|
|
+ doubleSpinBoxRightButtomX->setValue(position.x); // 更新 X 轴
|
|
|
|
+ doubleSpinBoxRightButtomY->setValue(position.y); // 更新 Y 轴
|
|
|
|
+ });
|
|
|
|
|
|
//layout->addLayout(subGridLayout, 11, 0);
|
|
//layout->addLayout(subGridLayout, 11, 0);
|
|
|
|
|
|
@@ -592,29 +702,59 @@ bool WaffleProgramPage::eventFilter(QObject* obj, QEvent* event) {
|
|
auto* lineEdit = qobject_cast<QLineEdit*>(obj);
|
|
auto* lineEdit = qobject_cast<QLineEdit*>(obj);
|
|
if (lineEdit)
|
|
if (lineEdit)
|
|
{
|
|
{
|
|
- int index = lineEdit->property("vectorIndex").toInt();
|
|
|
|
- onNoBondPtsClicked(lineEdit, index);
|
|
|
|
|
|
+ int index = lineEdit->property("vectorIndex").toInt(); // 当前矩阵索引
|
|
|
|
+ int parentIndex = lineEdit->property("parentMatrixIndex").toInt(); // 父矩阵索引
|
|
|
|
+
|
|
|
|
+ onNoBondPtsClicked(lineEdit, index, parentIndex); // 传递父矩阵索引
|
|
return true; // 拦截事件
|
|
return true; // 拦截事件
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return QWidget::eventFilter(obj, event);
|
|
return QWidget::eventFilter(obj, event);
|
|
}
|
|
}
|
|
|
|
|
|
-void WaffleProgramPage::onNoBondPtsClicked(QLineEdit* lineEdit, int index) {
|
|
|
|
- if (index < 0 || index >= m_vecWaffleMatrix.size()) return;
|
|
|
|
|
|
|
|
- const auto& waffle = m_vecWaffleMatrix[index];
|
|
|
|
- NoBondPtEditDialog dlg(waffle.PackRow, waffle.PackCol, waffle.VecNoBondDie, this);
|
|
|
|
|
|
+void WaffleProgramPage::onNoBondPtsClicked(QLineEdit* lineEdit, int index, int parentIndex) {
|
|
|
|
+ if (parentIndex != -1)
|
|
|
|
+ {
|
|
|
|
+ // 处理子矩阵的操作
|
|
|
|
+ if (index < 0 || index >= m_vecSubWaffleMatrix.size()) return;
|
|
|
|
+
|
|
|
|
+ const auto& subMatrix = m_vecSubWaffleMatrix[index];
|
|
|
|
+ NoBondPtEditDialog dlg(subMatrix.MatrixRow, subMatrix.MatrixCol, subMatrix.VecNoBondPt, this);
|
|
|
|
+
|
|
|
|
+ if (dlg.exec() == QDialog::Accepted)
|
|
|
|
+ {
|
|
|
|
+ QVector<XY_LONG_STRUCT> selected = dlg.getSelectedPoints();
|
|
|
|
+ m_vecSubWaffleMatrix[index].VecNoBondPt = std::vector<XY_LONG_STRUCT>(selected.begin(), selected.end());
|
|
|
|
|
|
- if (dlg.exec() == QDialog::Accepted)
|
|
|
|
|
|
+ QStringList ptList;
|
|
|
|
+ for (const auto& pt : selected)
|
|
|
|
+ ptList << QString("(%1,%2)").arg(pt.x).arg(pt.y);
|
|
|
|
+ lineEdit->setText(ptList.join(" "));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 这里可以用 parentIndex 来关联父矩阵(即大矩阵)做相应的操作
|
|
|
|
+ }
|
|
|
|
+ else
|
|
{
|
|
{
|
|
- QVector<XY_LONG_STRUCT> selected = dlg.getSelectedPoints();
|
|
|
|
- m_vecWaffleMatrix[index].VecNoBondDie = std::vector<XY_LONG_STRUCT>(selected.begin(), selected.end());
|
|
|
|
|
|
+ // 处理大矩阵的操作
|
|
|
|
+ if (index < 0 || index >= m_vecWaffleMatrix.size()) return;
|
|
|
|
+
|
|
|
|
+ const auto& waffleMatrix = m_vecWaffleMatrix[index];
|
|
|
|
+ NoBondPtEditDialog dlg(waffleMatrix.PackRow, waffleMatrix.PackCol, waffleMatrix.VecNoBondDie, this);
|
|
|
|
+
|
|
|
|
+ if (dlg.exec() == QDialog::Accepted)
|
|
|
|
+ {
|
|
|
|
+ QVector<XY_LONG_STRUCT> selected = dlg.getSelectedPoints();
|
|
|
|
+ m_vecWaffleMatrix[index].VecNoBondDie = std::vector<XY_LONG_STRUCT>(selected.begin(), selected.end());
|
|
|
|
|
|
- QStringList ptList;
|
|
|
|
- for (const auto& pt : selected)
|
|
|
|
- ptList << QString("(%1,%2)").arg(pt.x).arg(pt.y);
|
|
|
|
- lineEdit->setText(ptList.join(" "));
|
|
|
|
|
|
+ QStringList ptList;
|
|
|
|
+ for (const auto& pt : selected)
|
|
|
|
+ ptList << QString("(%1,%2)").arg(pt.x).arg(pt.y);
|
|
|
|
+ lineEdit->setText(ptList.join(" "));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 这里也可以用 parentIndex 来关联父矩阵(即大矩阵)做相应的操作
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -646,31 +786,16 @@ void WaffleProgramPage::MatrixChangeEvent()
|
|
void WaffleProgramPage::initPage()
|
|
void WaffleProgramPage::initPage()
|
|
{
|
|
{
|
|
m_vecWaffleMatrix = m_pProduct->GetWaffleMatrix();
|
|
m_vecWaffleMatrix = m_pProduct->GetWaffleMatrix();
|
|
|
|
+ m_pProduct->GetAllDieMatrix(m_vecSubWaffleMatrix);
|
|
for (int i = 0; i < m_vecWaffleMatrix.size(); i++)
|
|
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 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);
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
|
|
+ // 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);
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
}
|
|
}
|