12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322 |
- #include "BondMatrixProgramPage.h"
- #include "Src/RewriteControl/Controls/SpinBox.h"
- #include "Src/RewriteControl/Controls/DoubleSpinBox.h"
- #include <QPushButton>
- #include <QtWidgets/qmessagebox.h>
- #include <View/die-bonder-ui/Src/MatrixDialogs/NoBondPtEditDialog.h>
- BondMatrixProgramPage::BondMatrixProgramPage(QWidget* parent) :
- QWidget(parent)
- {
- ui.setupUi(this);
- ui.pushButtonSave->setProperty("type", "save");
- 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();
- if (m_manageDB == nullptr) return;
- m_pProduct = m_manageDB->GetCProduct();
- if (m_pProduct == nullptr) return;
- m_pProgramCViewInterface = ns_module::CViewInterface::GetInstance();
- ui.frame->setFrameShape(QFrame::NoFrame); // 移除默认框架
- ui.frame->setFixedHeight(2); // 设置固定高度
- ui.frame->setStyleSheet("background-color: #C7CAEB;");
- //ui.tab->setStyleSheet("background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #F1F4FD, stop: 1 #E5E4F6)");
- initPage();
- connect(ui.pushButtonSave, &QPushButton::clicked, this, [=] {
- ParamChangeEvent();
- MatrixChangeEvent();
- });
- connect(ui.pushButtonAddOutMatrix, &QPushButton::clicked, this, [=]() {
- PROGRAM_BOND_MATRIX_STRUCT newMatrix;
- //排序
- std::sort(m_vectBondMatrixs.begin(), m_vectBondMatrixs.end(),
- [](const PROGRAM_BOND_MATRIX_STRUCT& a, const PROGRAM_BOND_MATRIX_STRUCT& b) {
- return a.BondMatrixId < b.BondMatrixId;
- });
- //找Id
- int newId = 1;
- for (const auto& matrix : m_vectBondMatrixs)
- {
- if (matrix.BondMatrixId == newId)
- {
- newId++;
- }
- else if (matrix.BondMatrixId > newId)
- {
- break;
- }
- }
- newMatrix.BondMatrixId = newId;
- newMatrix.BondMatrixRow = 0;
- newMatrix.BondMatrixCol = 0;
- int newVectorIndex = m_vectBondMatrixs.size();
- std::vector<PROGRAM_POINT_MATRIX_STRUCT> newVecSubMatrix;
- m_vectBondMatrixs.push_back(newMatrix);
- AddOutMatrixPage(newVectorIndex, newMatrix, newVecSubMatrix);
- });
- //参数
- connect(ui.comboBoxDieSource, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [=](int index) {
- if (index == 0)
- {
- m_curBondInfo.eDieSource = DIE_SOURCE::BY_WAFFLE;
- }
- else if (index == 1)
- {
- m_curBondInfo.eDieSource = DIE_SOURCE::BY_WAFER;
- }
- ParamChangeEvent();
- });
- connect(ui.checkBoxIsCalib, &QCheckBox::clicked, this, [=](bool isChecked) {
- });
- connect(ui.spinBoxPickTempID, &SpinBox::editDone, this, [=]() {
- m_curBondInfo.iPickPRStrategyId = ui.spinBoxPickTempID->value();
- ParamChangeEvent();
- });
- connect(ui.spinBoxPickNozzleID, &SpinBox::editDone, this, [=]() {
- m_curBondInfo.iPickHeadId = ui.spinBoxPickNozzleID->value();
- ParamChangeEvent();
- });
- connect(ui.spinBoxPreBondTemp, &SpinBox::editDone, this, [=]() {
- m_curBondInfo.iBondFrontPRStrategyId = ui.spinBoxPreBondTemp->value();
- ParamChangeEvent();
- });
- connect(ui.spinBoxPostBondTemp, &SpinBox::editDone, this, [=]() {
- m_curBondInfo.iBondBackPRStrategyId = ui.spinBoxPostBondTemp->value();
- ParamChangeEvent();
- });
- connect(ui.spinBoxBondTemp, &SpinBox::editDone, this, [=]() {
- m_curBondInfo.iBondPRStrategyId = ui.spinBoxBondTemp->value();
- ParamChangeEvent();
- });
- connect(ui.spinBoxLookUpTemp, &SpinBox::editDone, this, [=]() {
- m_curBondInfo.iLookUpPRStrategyId = ui.spinBoxLookUpTemp->value();
- ParamChangeEvent();
- });
- connect(ui.spinBoxCalibPickTemp, &SpinBox::editDone, this, [=]() {
- m_curBondInfo.iCalibPRStrategyId = ui.spinBoxCalibPickTemp->value();
- ParamChangeEvent();
- });
- connect(ui.spinBoxBondNozzleID, &SpinBox::editDone, this, [=]() {
- m_curBondInfo.iBondHeadId = ui.spinBoxBondNozzleID->value();
- ParamChangeEvent();
- });
- connect(ui.doubleSpinBoxBondOffsetX, &DoubleSpinBox::editDone, this, [=]() {
- m_curBondInfo.stOffset.x = ui.doubleSpinBoxBondOffsetX->value();
- ParamChangeEvent();
- });
- connect(ui.doubleSpinBoxBondOffsetY, &DoubleSpinBox::editDone, this, [=]() {
- m_curBondInfo.stOffset.y = ui.doubleSpinBoxBondOffsetY->value();
- ParamChangeEvent();
- });
- connect(ui.doubleSpinBoxBondOffsetAngle, &DoubleSpinBox::editDone, this, [=]() {
- m_curBondInfo.stOffset.a = ui.doubleSpinBoxBondOffsetAngle->value();
- ParamChangeEvent();
- });
- connect(ui.comboBoxPickParamType, &QComboBox::currentTextChanged, this, [=]() {
- UpdatePagePickParam();
- });
- connect(ui.checkBoxPickBlockCheck, &QCheckBox::clicked, this, [=](bool isChecked) {
- if (ui.comboBoxPickParamType->currentIndex() == 0)//华夫盒
- {
- m_curWaferPickParam.bCheckBlock = ui.checkBoxPickBlockCheck->isChecked();
- }
- else if (ui.comboBoxPickParamType->currentIndex() == 1)//晶圆台
- {
- m_curCalibPickParam.bCheckBlock = ui.checkBoxPickBlockCheck->isChecked();
- }
- ParamChangeEvent();
- });
- connect(ui.checkBoxPickLoseCheck, &QCheckBox::clicked, this, [=](bool isChecked) {
- if (ui.comboBoxPickParamType->currentIndex() == 0)//华夫盒
- {
- m_curWaferPickParam.bCheckLose = ui.checkBoxPickLoseCheck->isChecked();
- }
- else if (ui.comboBoxPickParamType->currentIndex() == 1)//晶圆台
- {
- m_curCalibPickParam.bCheckLose = ui.checkBoxPickLoseCheck->isChecked();
- }
- ParamChangeEvent();
- });
- connect(ui.checkBoxPickFindForceCheck, &QCheckBox::clicked, this, [=](bool isChecked) {
- if (ui.comboBoxPickParamType->currentIndex() == 0)//华夫盒
- {
- m_curWaferPickParam.bFindForce = ui.checkBoxPickFindForceCheck->isChecked();
- }
- else if (ui.comboBoxPickParamType->currentIndex() == 1)//晶圆台
- {
- m_curCalibPickParam.bFindForce = ui.checkBoxPickFindForceCheck->isChecked();
- }
- ParamChangeEvent();
- });
- connect(ui.doubleSpinBoxPrePickZ, &DoubleSpinBox::editDone, this, [=]() {
- if (ui.comboBoxPickParamType->currentIndex() == 0)//华夫盒
- {
- m_curWaferPickParam.dPreLev = ui.doubleSpinBoxPrePickZ->value();
- }
- else if (ui.comboBoxPickParamType->currentIndex() == 1)//晶圆台
- {
- m_curCalibPickParam.dPreLev = ui.doubleSpinBoxPrePickZ->value();
- }
- ParamChangeEvent();
- });
- connect(ui.doubleSpinBoxPickForce, &DoubleSpinBox::editDone, this, [=]() {
- if (ui.comboBoxPickParamType->currentIndex() == 0)//华夫盒
- {
- m_curWaferPickParam.dForce = ui.doubleSpinBoxPickForce->value();
- }
- else if (ui.comboBoxPickParamType->currentIndex() == 1)//晶圆台
- {
- m_curCalibPickParam.dForce = ui.doubleSpinBoxPickForce->value();
- }
- ParamChangeEvent();
- });
- connect(ui.doubleSpinBoxPickPosZ, &DoubleSpinBox::editDone, this, [=]() {
- if (ui.comboBoxPickParamType->currentIndex() == 0)//华夫盒
- {
- m_curWaferPickParam.dWorkLev = ui.doubleSpinBoxPickPosZ->value();
- }
- else if (ui.comboBoxPickParamType->currentIndex() == 1)//晶圆台
- {
- m_curCalibPickParam.dWorkLev = ui.doubleSpinBoxPickPosZ->value();
- }
- ParamChangeEvent();
- });
- connect(ui.spinBoxPickGrabDelay, &SpinBox::editDone, this, [=]() {
- if (ui.comboBoxPickParamType->currentIndex() == 0)//华夫盒
- {
- m_curWaferPickParam.iGrabDelay = ui.spinBoxPickGrabDelay->value();
- }
- else if (ui.comboBoxPickParamType->currentIndex() == 1)//晶圆台
- {
- m_curCalibPickParam.iGrabDelay = ui.spinBoxPickGrabDelay->value();
- }
- ParamChangeEvent();
- });
- connect(ui.spinBox_PickDelay, &SpinBox::editDone, this, [=]() {
- if (ui.comboBoxPickParamType->currentIndex() == 0)//华夫盒
- {
- m_curWaferPickParam.iPickOrBondDelay = ui.spinBox_PickDelay->value();
- }
- else if (ui.comboBoxPickParamType->currentIndex() == 1)//晶圆台
- {
- m_curCalibPickParam.iPickOrBondDelay = ui.spinBox_PickDelay->value();
- }
- ParamChangeEvent();
- });
- connect(ui.spinBoxPickBlockCheckDelay, &SpinBox::editDone, this, [=]() {
- if (ui.comboBoxPickParamType->currentIndex() == 0)//华夫盒
- {
- m_curWaferPickParam.iBlockOrLoseDelay = ui.spinBoxPickBlockCheckDelay->value();
- }
- else if (ui.comboBoxPickParamType->currentIndex() == 1)//晶圆台
- {
- m_curCalibPickParam.iBlockOrLoseDelay = ui.spinBoxPickBlockCheckDelay->value();
- }
- ParamChangeEvent();
- });
- connect(ui.spinBoxPickVacDelay, &SpinBox::editDone, this, [=]() {
- if (ui.comboBoxPickParamType->currentIndex() == 0)//华夫盒
- {
- m_curWaferPickParam.iVacuumDelay = ui.spinBoxPickVacDelay->value();
- }
- else if (ui.comboBoxPickParamType->currentIndex() == 1)//晶圆台
- {
- m_curCalibPickParam.iVacuumDelay = ui.spinBoxPickVacDelay->value();
- }
- ParamChangeEvent();
- });
- connect(ui.spinBoxPickBlowDelay, &SpinBox::editDone, this, [=]() {
- if (ui.comboBoxPickParamType->currentIndex() == 0)//华夫盒
- {
- m_curWaferPickParam.iBlowDelay = ui.spinBoxPickBlowDelay->value();
- }
- else if (ui.comboBoxPickParamType->currentIndex() == 1)//晶圆台
- {
- m_curCalibPickParam.iBlowDelay = ui.spinBoxPickBlowDelay->value();
- }
- ParamChangeEvent();
- });
- connect(ui.comboBoxBondParamType, &QComboBox::currentTextChanged, this, [=]() {
- UpdatePageBondParam();
- });
- connect(ui.checkBoxBondBlockCheck, &QCheckBox::clicked, this, [=](bool isChecked) {
- if (ui.comboBoxBondParamType->currentIndex() == 0)//中转台放晶
- {
- m_curCalibPlaceParam.bCheckBlock = ui.checkBoxBondBlockCheck->isChecked();
- }
- else if (ui.comboBoxBondParamType->currentIndex() == 1)//固晶台固晶
- {
- m_curBondParam.bCheckBlock = ui.checkBoxBondBlockCheck->isChecked();
- }
- ParamChangeEvent();
- });
- connect(ui.checkBoxBondLoseCheck, &QCheckBox::clicked, this, [=](bool isChecked) {
- if (ui.comboBoxBondParamType->currentIndex() == 0)//中转台放晶
- {
- m_curCalibPlaceParam.bCheckLose = ui.checkBoxBondLoseCheck->isChecked();
- }
- else if (ui.comboBoxBondParamType->currentIndex() == 1)//固晶台固晶
- {
- m_curBondParam.bCheckLose = ui.checkBoxBondLoseCheck->isChecked();
- }
- ParamChangeEvent();
- });
- connect(ui.checkBoxBondFindForce, &QCheckBox::clicked, this, [=](bool isChecked) {
- if (ui.comboBoxBondParamType->currentIndex() == 0)//中转台放晶
- {
- m_curCalibPlaceParam.bFindForce = ui.checkBoxBondFindForce->isChecked();
- }
- else if (ui.comboBoxBondParamType->currentIndex() == 1)//固晶台固晶
- {
- m_curBondParam.bFindForce = ui.checkBoxBondFindForce->isChecked();
- }
- ParamChangeEvent();
- });
- connect(ui.doubleSpinBoxPreBondPosZ, &DoubleSpinBox::editDone, this, [=]() {
- if (ui.comboBoxBondParamType->currentIndex() == 0)//中转台放晶
- {
- m_curCalibPlaceParam.dPreLev = ui.doubleSpinBoxPreBondPosZ->value();
- }
- else if (ui.comboBoxBondParamType->currentIndex() == 1)//固晶台固晶
- {
- m_curBondParam.dPreLev = ui.doubleSpinBoxPreBondPosZ->value();
- }
- ParamChangeEvent();
- });
- connect(ui.doubleSpinBoxBondForce, &DoubleSpinBox::editDone, this, [=]() {
- if (ui.comboBoxBondParamType->currentIndex() == 0)//中转台放晶
- {
- m_curCalibPlaceParam.dForce = ui.doubleSpinBoxBondForce->value();
- }
- else if (ui.comboBoxBondParamType->currentIndex() == 1)//固晶台固晶
- {
- m_curBondParam.dForce = ui.doubleSpinBoxBondForce->value();
- }
- ParamChangeEvent();
- });
- connect(ui.doubleSpinBoxBondPosZ, &DoubleSpinBox::editDone, this, [=]() {
- if (ui.comboBoxBondParamType->currentIndex() == 0)//中转台放晶
- {
- m_curCalibPlaceParam.dWorkLev = ui.doubleSpinBoxBondPosZ->value();
- }
- else if (ui.comboBoxBondParamType->currentIndex() == 1)//固晶台固晶
- {
- m_curBondParam.dWorkLev = ui.doubleSpinBoxBondPosZ->value();
- }
- ParamChangeEvent();
- });
- connect(ui.spinBoxBondGrabDelay, &SpinBox::editDone, this, [=]() {
- if (ui.comboBoxBondParamType->currentIndex() == 0)//中转台放晶
- {
- m_curCalibPlaceParam.iGrabDelay = ui.spinBoxBondGrabDelay->value();
- }
- else if (ui.comboBoxBondParamType->currentIndex() == 1)//固晶台固晶
- {
- m_curBondParam.iGrabDelay = ui.spinBoxBondGrabDelay->value();
- }
- ParamChangeEvent();
- });
- connect(ui.spinBoxBondBlockCheckDelay, &SpinBox::editDone, this, [=]() {
- if (ui.comboBoxBondParamType->currentIndex() == 0)//中转台放晶
- {
- m_curCalibPlaceParam.iBlockOrLoseDelay = ui.spinBoxBondBlockCheckDelay->value();
- }
- else if (ui.comboBoxBondParamType->currentIndex() == 1)//固晶台固晶
- {
- m_curBondParam.iBlockOrLoseDelay = ui.spinBoxBondBlockCheckDelay->value();
- }
- ParamChangeEvent();
- });
- connect(ui.spinBoxBondDelay, &SpinBox::editDone, this, [=]() {
- if (ui.comboBoxBondParamType->currentIndex() == 0)//中转台放晶
- {
- m_curCalibPlaceParam.iPickOrBondDelay = ui.spinBoxBondDelay->value();
- }
- else if (ui.comboBoxBondParamType->currentIndex() == 1)//固晶台固晶
- {
- m_curBondParam.iPickOrBondDelay = ui.spinBoxBondDelay->value();
- }
- ParamChangeEvent();
- });
- connect(ui.spinBoxBondVacDelay, &SpinBox::editDone, this, [=]() {
- if (ui.comboBoxBondParamType->currentIndex() == 0)//中转台放晶
- {
- m_curCalibPlaceParam.iVacuumDelay = ui.spinBoxBondVacDelay->value();
- }
- else if (ui.comboBoxBondParamType->currentIndex() == 1)//固晶台固晶
- {
- m_curBondParam.iVacuumDelay = ui.spinBoxBondVacDelay->value();
- }
- ParamChangeEvent();
- });
- connect(ui.spinBoxBondBlowDelay, &SpinBox::editDone, this, [=]() {
- if (ui.comboBoxBondParamType->currentIndex() == 0)//中转台放晶
- {
- m_curCalibPlaceParam.iBlowDelay = ui.spinBoxBondBlowDelay->value();
- }
- else if (ui.comboBoxBondParamType->currentIndex() == 1)//固晶台固晶
- {
- m_curBondParam.iBlowDelay = ui.spinBoxBondBlowDelay->value();
- }
- ParamChangeEvent();
- });
- }
- BondMatrixProgramPage::~BondMatrixProgramPage()
- {
- }
- XY_DOUBLE_STRUCT BondMatrixProgramPage::BondGetAxisPosition(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 BondMatrixProgramPage::AddOutMatrixPage(int vectorIndex, PROGRAM_BOND_MATRIX_STRUCT matrixData, std::vector<PROGRAM_POINT_MATRIX_STRUCT> vecSubMatrix)
- {
- int matrixNum = m_mapSubMatrixControls.size();
- int newMatrixID = ++matrixNum;
- QVector<QObject*> vecControls;
- QWidget* outWidget = new QWidget();
- QGridLayout* outMatrixGridLayout = new QGridLayout();
- outMatrixGridLayout->setSpacing(4);
- outMatrixGridLayout->setObjectName(QString::fromUtf8("Out GridLayout"));
- outMatrixGridLayout->setContentsMargins(0, 0, 0, 0); // 设置布局的边距为0
- QGridLayout* boxGridLayout = new QGridLayout();
- boxGridLayout->setSpacing(4);
- boxGridLayout->setObjectName(QString::fromUtf8("Box GridLayout"));
- boxGridLayout->setContentsMargins(0, 0, 0, 0); // 设置布局的边距为0
- QHBoxLayout* buttonLayout = new QHBoxLayout();
- QSpacerItem* item = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
- buttonLayout->addSpacerItem(item);
- QGroupBox* groupBox = new QGroupBox(outWidget);
- groupBox->setLayout(boxGridLayout);
- QGridLayout* matrixGridLayout = new QGridLayout();
- matrixGridLayout->setSpacing(4);
- matrixGridLayout->setObjectName(QString::fromUtf8("matrixGridLayout"));
- matrixGridLayout->setContentsMargins(0, 0, 0, 0); // 设置布局的边距为0
- //// Add line for separation
- //QFrame* line = new QFrame();
- //line->setFrameShape(QFrame::NoFrame); // Remove default frame
- //line->setFixedHeight(2); // Set fixed height for line
- //line->setStyleSheet("background-color: #C7CAEB;");
- //outMatrixGridLayout->addWidget(line, 0, 0, 1, 4);
- // Add matrix title
- QLabel* labelTitle = new QLabel(outWidget);
- labelTitle->setObjectName(QString::fromUtf8("labelTitle"));
- labelTitle->setText(tr("Bond Matrix ") + QString::number(vectorIndex));
- labelTitle->setStyleSheet("color: #6A78FF;height: 30px");
- matrixGridLayout->addWidget(labelTitle, 0, 0, 1, 1);
- vecControls.push_back(labelTitle);
- //// Add Delete Out Matrix button
- //QPushButton* buttonDeleteOutMatrix = new QPushButton("Delete Matrix", outWidget);
- //outMatrixGridLayout->addWidget(buttonDeleteOutMatrix, 8, 0, 1, 3);
- //connect(buttonDeleteOutMatrix, &QPushButton::clicked, this, [=]() {
- // m_vectBondMatrixs.erase(m_vectBondMatrixs.begin() + vectorIndex);
- // delete outWidget;
- // });
- // Add "Add Sub Matrix" button
- QPushButton* pushButtonAdd = new QPushButton(outWidget);
- pushButtonAdd->setObjectName(QString::fromUtf8("button Add"));
- pushButtonAdd->setText(tr("Add sub Matrix"));
- matrixGridLayout->addWidget(pushButtonAdd, 0, 2, 1, 2);
- pushButtonAdd->setProperty("type", "default");
- connect(pushButtonAdd, &QPushButton::clicked, this, [=]() {
- int newSubMatrixIndex = m_vecSubMatrixs.size();
- PROGRAM_POINT_MATRIX_STRUCT subMatrix;
- std::sort(m_vecSubMatrixs.begin(), m_vecSubMatrixs.end(),
- [](const PROGRAM_POINT_MATRIX_STRUCT& a, const PROGRAM_POINT_MATRIX_STRUCT& b) {
- return a.MatrixId < b.MatrixId;
- });
- //找Id
- int newId = 1;
- for (const auto& matrix : m_vecSubMatrixs)
- {
- if (matrix.MatrixId == newId)
- {
- newId++;
- }
- else if (matrix.MatrixId > newId)
- {
- break;
- }
- }
- subMatrix.MatrixId = newId;
- subMatrix.strModuleName = "UltraHead";
- subMatrix.iModuleId = MODULE_LIST::BondHead;
- subMatrix.MatrixRow = 0;
- subMatrix.MatrixCol = 0;
- m_vecSubMatrixs.push_back(subMatrix);
- // Add the submatrix to the bond matrix's VecPointMatrixId
- //找大矩阵ID/Index
- auto currentIt = m_mapOutWidgetIndex.find(outWidget);
- int index = currentIt.value(); //迭代器 erase后currentIt被删除了
- m_vectBondMatrixs[index].VecPointMatrixId.push_back(newId);
- AddMatrixPage(index, newSubMatrixIndex, subMatrix, outMatrixGridLayout);
- });
- // Add Delete Out Matrix button
- QPushButton* pushButtonDelete = new QPushButton(outWidget);
- pushButtonDelete->setObjectName(QString::fromUtf8("button delete"));
- pushButtonDelete->setText(tr("Delete"));
- matrixGridLayout->addWidget(pushButtonDelete, 0, 1, 1, 1);
- connect(pushButtonDelete, &QPushButton::clicked, this, [=]() {
- //处理index
- auto currentIt = m_mapOutWidgetIndex.find(outWidget);
- int index = currentIt.value(); //迭代器 erase后currentIt被删除了
- m_mapOutWidgetIndex.erase(currentIt);
- for (auto it = m_mapOutWidgetIndex.begin(); it != m_mapOutWidgetIndex.end(); it++)
- {
- if (it.value() > index)
- {
- int newIndex = it.value() - 1;
- m_mapOutWidgetIndex.insert(it.key(), newIndex);
- }
- }
- //删除缓存数据
- m_vectBondMatrixs.erase(m_vectBondMatrixs.begin() + vectorIndex);
- //m_mapBondMatrixToSubMatrices.remove(vectorIndex); // Remove mapping between BondMatrix and its SubMatrices
- delete outWidget;
- });
- // Add Row and Column controls
- QLabel* labelRow = new QLabel(outWidget);
- labelRow->setObjectName(QString::fromUtf8("labelRow"));
- labelRow->setText(tr("Row & Cow"));
- matrixGridLayout->addWidget(labelRow, 2, 0, 1, 1);
- vecControls.push_back(labelRow);
- SpinBox* spinBoxRow = new SpinBox(outWidget);
- spinBoxRow->setObjectName(QString::fromUtf8("spinBoxRow"));
- spinBoxRow->setFixedWidth(100); // Set fixed width to 100
- matrixGridLayout->addWidget(spinBoxRow, 2, 1, 1, 1);
- vecControls.push_back(spinBoxRow);
- /*QLabel* labelCol = new QLabel(outWidget);
- labelCol->setObjectName(QString::fromUtf8("labelCol"));
- labelCol->setText(tr("Column "));
- outMatrixGridLayout->addWidget(labelCol, 3, 0, 1, 1);
- vecControls.push_back(labelCol);*/
- SpinBox* spinBoxCol = new SpinBox(outWidget);
- spinBoxCol->setObjectName(QString::fromUtf8("spinBoxCol"));
- spinBoxCol->setFixedWidth(100); // Set fixed width to 100
- matrixGridLayout->addWidget(spinBoxCol, 2, 2, 1, 1);
- vecControls.push_back(spinBoxCol);
- // Add Left Top Position controls
- QLabel* labelLeftTop = new QLabel(outWidget);
- labelLeftTop->setObjectName(QString::fromUtf8("labelLeftTop"));
- labelLeftTop->setText(tr("Left Top Pos "));
- matrixGridLayout->addWidget(labelLeftTop, 4, 0, 1, 1);
- vecControls.push_back(labelLeftTop);
- DoubleSpinBox* doubleSpinBoxLeftTopX = new DoubleSpinBox(outWidget);
- doubleSpinBoxLeftTopX->setObjectName(QString::fromUtf8("doubleSpinBoxLeftTopX"));
- doubleSpinBoxLeftTopX->setFixedWidth(100); // Set fixed width to 100
- matrixGridLayout->addWidget(doubleSpinBoxLeftTopX, 4, 1, 1, 1);
- vecControls.push_back(doubleSpinBoxLeftTopX);
- DoubleSpinBox* doubleSpinBoxLeftTopY = new DoubleSpinBox(outWidget);
- doubleSpinBoxLeftTopY->setObjectName(QString::fromUtf8("doubleSpinBoxLeftTopY"));
- doubleSpinBoxLeftTopY->setFixedWidth(100); // Set fixed width to 100
- matrixGridLayout->addWidget(doubleSpinBoxLeftTopY, 4, 2, 1, 1);
- vecControls.push_back(doubleSpinBoxLeftTopY);
- // Add Get Pos button for Left Top
- 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 = BondGetAxisPosition("BondMatrix", m_vectBondMatrixs[vectorIndex].LeftTopPoint);
- doubleSpinBoxLeftTopX->setValue(position.x);
- doubleSpinBoxLeftTopY->setValue(position.y);
- });
- // Add Right Top Position controls
- QLabel* labelRightTopPos = new QLabel(outWidget);
- labelRightTopPos->setObjectName(QString::fromUtf8("labelRightTopPos"));
- labelRightTopPos->setText(tr("Right Top Pos "));
- matrixGridLayout->addWidget(labelRightTopPos, 5, 0, 1, 1);
- vecControls.push_back(labelRightTopPos);
- DoubleSpinBox* doubleSpinBoxRightTopX = new DoubleSpinBox(outWidget);
- doubleSpinBoxRightTopX->setObjectName(QString::fromUtf8("doubleSpinBoxRightTopX"));
- doubleSpinBoxRightTopX->setFixedWidth(100); // Set fixed width to 100
- matrixGridLayout->addWidget(doubleSpinBoxRightTopX, 5, 1, 1, 1);
- vecControls.push_back(doubleSpinBoxRightTopX);
- DoubleSpinBox* doubleSpinBoxRightTopY = new DoubleSpinBox(outWidget);
- doubleSpinBoxRightTopY->setObjectName(QString::fromUtf8("doubleSpinBoxRightTopY"));
- doubleSpinBoxRightTopY->setFixedWidth(100); // Set fixed width to 100
- matrixGridLayout->addWidget(doubleSpinBoxRightTopY, 5, 2, 1, 1);
- 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 = BondGetAxisPosition("BondMatrix", m_vectBondMatrixs[vectorIndex].RightTopPoint);
- doubleSpinBoxRightTopX->setValue(position.x);
- doubleSpinBoxRightTopY->setValue(position.y);
- });
- // Add Right Bottom Position controls
- QLabel* labelRightButtomPos = new QLabel(outWidget);
- labelRightButtomPos->setObjectName(QString::fromUtf8("labelRightButtomPos"));
- labelRightButtomPos->setText(tr("Right Buttom pos"));
- matrixGridLayout->addWidget(labelRightButtomPos, 6, 0, 1, 1);
- vecControls.push_back(labelRightButtomPos);
- DoubleSpinBox* doubleSpinBoxRightButtomX = new DoubleSpinBox(outWidget);
- doubleSpinBoxRightButtomX->setObjectName(QString::fromUtf8("doubleSpinBoxRightButtomX"));
- doubleSpinBoxRightButtomX->setFixedWidth(100); // Set fixed width to 100
- matrixGridLayout->addWidget(doubleSpinBoxRightButtomX, 6, 1, 1, 1);
- vecControls.push_back(doubleSpinBoxRightButtomX);
- DoubleSpinBox* doubleSpinBoxRightButtomY = new DoubleSpinBox(outWidget);
- doubleSpinBoxRightButtomY->setObjectName(QString::fromUtf8("doubleSpinBoxRightButtomY"));
- doubleSpinBoxRightButtomY->setFixedWidth(100); // Set fixed width to 100
- matrixGridLayout->addWidget(doubleSpinBoxRightButtomY, 6, 2, 1, 1);
- 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 = BondGetAxisPosition("BondMatrix", m_vectBondMatrixs[vectorIndex].RightBottomPoint);
- doubleSpinBoxRightButtomX->setValue(position.x);
- doubleSpinBoxRightButtomY->setValue(position.y);
- });
- // Add No Bond Points line edit
- QLabel* labelNoBondPts = new QLabel(outWidget);
- labelNoBondPts->setObjectName(QString::fromUtf8("labelNoBondPts"));
- labelNoBondPts->setText(tr("No Bond Points"));
- matrixGridLayout->addWidget(labelNoBondPts, 7, 0, 1, 1);
- vecControls.push_back(labelNoBondPts);
- QLineEdit* lineEditNoBondPts = new QLineEdit(outWidget);
- lineEditNoBondPts->setObjectName(QString::fromUtf8("lineEditNoBondPts"));
- matrixGridLayout->addWidget(lineEditNoBondPts, 7, 1, 1, 3);
- vecControls.push_back(lineEditNoBondPts);
- lineEditNoBondPts->setReadOnly(true);
- lineEditNoBondPts->setCursor(Qt::PointingHandCursor);
- lineEditNoBondPts->setProperty("vectorIndex", vectorIndex); // 存储索引
- lineEditNoBondPts->setProperty("parentMatrixIndex", -1); // 设置父矩阵的索引
- lineEditNoBondPts->installEventFilter(this);
- QFrame* line = new QFrame(outWidget);
- line->setFrameShape(QFrame::NoFrame); // 移除默认框架
- line->setFixedHeight(2); // 设置固定高度
- line->setStyleSheet("background-color: #C7CAEB;");
- boxGridLayout->addLayout(matrixGridLayout, 2, 0);
- boxGridLayout->addWidget(line);
- //outMatrixGridLayout->addLayout(buttonLayout, 1, 0);
- outMatrixGridLayout->addWidget(groupBox);
- outWidget->setLayout(outMatrixGridLayout);
- ui.verticalLayout_3->addWidget(outWidget);
- ui.verticalLayout_3->setContentsMargins(0, 0, 0, 0); // Adjust margins if necessary
- ui.verticalLayout_3->setAlignment(Qt::AlignTop | Qt::AlignLeft); // Align the layout to the top-left
- m_mapOutWidgetIndex.insert(outWidget, vectorIndex);
- // Add Sub Matrices
- for (int j = 0; j < matrixData.VecPointMatrixId.size(); j++)
- {
- for (int i = 0; i < m_vecSubMatrixs.size(); i++)
- {
- if (matrixData.VecPointMatrixId[j] == m_vecSubMatrixs[i].MatrixId)
- {
- AddMatrixPage(j, i, m_vecSubMatrixs[i], outMatrixGridLayout);
- }
- }
- }
- /*for (int i = 0; i < vecSubMatrix.size(); i++)
- {
- AddMatrixPage(i, vecSubMatrix[i], outMatrixGridLayout);
- }*/
- QSpacerItem* vSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
- ui.verticalLayout_3->addItem(vSpacer);
- // Add all controls and finalize layout
- /*outWidget->setLayout(outMatrixGridLayout);
- ui.scrollArea_2->setLayout(outMatrixGridLayout);*/
- spinBoxRow->setValue(matrixData.BondMatrixRow);
- spinBoxCol->setValue(matrixData.BondMatrixCol);
- doubleSpinBoxLeftTopX->setValue(matrixData.LeftTopPoint.x);
- doubleSpinBoxLeftTopY->setValue(matrixData.LeftTopPoint.y);
- doubleSpinBoxRightTopX->setValue(matrixData.RightTopPoint.x);
- doubleSpinBoxRightTopY->setValue(matrixData.RightTopPoint.y);
- doubleSpinBoxRightButtomX->setValue(matrixData.RightBottomPoint.x);
- doubleSpinBoxRightButtomY->setValue(matrixData.RightBottomPoint.y);
- connect(spinBoxRow, &SpinBox::editDone, this, [=]() {
- m_vectBondMatrixs[vectorIndex].BondMatrixRow = spinBoxRow->value();
- });
- connect(spinBoxCol, &SpinBox::editDone, this, [=]() {
- m_vectBondMatrixs[vectorIndex].BondMatrixCol = spinBoxCol->value();
- });
- connect(doubleSpinBoxLeftTopX, &DoubleSpinBox::editDone, this, [=]() {
- m_vectBondMatrixs[vectorIndex].LeftTopPoint.x = doubleSpinBoxLeftTopX->value();
- });
- connect(doubleSpinBoxLeftTopY, &DoubleSpinBox::editDone, this, [=]() {
- m_vectBondMatrixs[vectorIndex].LeftTopPoint.y = doubleSpinBoxLeftTopY->value();
- });
- connect(doubleSpinBoxRightTopX, &DoubleSpinBox::editDone, this, [=]() {
- m_vectBondMatrixs[vectorIndex].RightTopPoint.x = doubleSpinBoxRightTopX->value();
- });
- connect(doubleSpinBoxRightTopY, &DoubleSpinBox::editDone, this, [=]() {
- m_vectBondMatrixs[vectorIndex].RightTopPoint.y = doubleSpinBoxRightTopY->value();
- });
- connect(doubleSpinBoxRightButtomX, &DoubleSpinBox::editDone, this, [=]() {
- m_vectBondMatrixs[vectorIndex].RightBottomPoint.x = doubleSpinBoxRightButtomX->value();
- });
- connect(doubleSpinBoxRightButtomY, &DoubleSpinBox::editDone, this, [=]() {
- m_vectBondMatrixs[vectorIndex].RightBottomPoint.y = doubleSpinBoxRightButtomY->value();
- });
- connect(lineEditNoBondPts, &QLineEdit::textChanged, this, [=]() {
- });
- }
- void BondMatrixProgramPage::AddMatrixPage(int vectorIndex, int subVectorIndex, PROGRAM_POINT_MATRIX_STRUCT subMatrix, QGridLayout* layout)
- {
- QVector<QObject*> vecControls;
- QWidget* subWidget = new QWidget();
- QGridLayout* subGridLayout = new QGridLayout(subWidget);
- subGridLayout->setSpacing(4);
- subGridLayout->setObjectName(QString::fromUtf8("subGridLayout"));
- //groupBox->setLayout(subGridLayout);
- subGridLayout->setContentsMargins(0, 0, 0, 0); // 设置布局的边距为0
- subGridLayout->setAlignment(Qt::AlignCenter);
- QLabel* labelTitle = new QLabel(subWidget);
- labelTitle->setObjectName(QString::fromUtf8("labelTitle"));
- labelTitle->setText(tr("Sub Matrix ") + QString::number(subVectorIndex));
- labelTitle->setStyleSheet("color: #808BFF;height: 30px");
- subGridLayout->addWidget(labelTitle, 0, 1, 1, 1);
- vecControls.push_back(labelTitle);
- QPushButton* pushButtonDelete = new QPushButton(subWidget);
- pushButtonDelete->setObjectName(QString::fromUtf8("button delete"));
- pushButtonDelete->setText(tr("Delete"));
- subGridLayout->addWidget(pushButtonDelete, 0, 3, 1, 1);
- connect(pushButtonDelete, &QPushButton::clicked, this, [=]() {
- //处理index
- auto currentIt = m_mapSubWidgetIndex.find(subWidget);
- int index = currentIt.value(); //迭代器 erase后currentIt被删除了
- m_mapSubWidgetIndex.erase(currentIt);
- for (auto it = m_mapSubWidgetIndex.begin(); it != m_mapSubWidgetIndex.end(); ++it)
- {
- if (it.value() > index)
- {
- //value() 返回的是副本不是引用
- int newIndex = it.value() - 1;
- m_mapSubWidgetIndex.insert(it.key(), newIndex);
- }
- }
- // 子矩阵ID
- int subMatrixId = m_vecSubMatrixs[index].MatrixId;
- //删除缓存
- m_vecSubMatrixs.erase(m_vecSubMatrixs.begin() + index);
- //删除大矩阵子ID数据(遍历删除)
- for (PROGRAM_BOND_MATRIX_STRUCT& matrix : m_vectBondMatrixs)
- {
- auto it = std::find(matrix.VecPointMatrixId.begin(), matrix.VecPointMatrixId.end(), subMatrixId);
- if (it != matrix.VecPointMatrixId.end())
- {
- matrix.VecPointMatrixId.erase(it);
- }
- }
- delete subWidget;
- });
- QLabel* labelRow = new QLabel(subWidget);
- labelRow->setObjectName(QString::fromUtf8("labelRow"));
- labelRow->setText(tr("Row & Cow"));
- subGridLayout->addWidget(labelRow, 2, 0, 1, 1);
- vecControls.push_back(labelRow);
- SpinBox* spinBoxRow = new SpinBox(subWidget);
- spinBoxRow->setObjectName(QString::fromUtf8("spinBoxRow"));
- subGridLayout->addWidget(spinBoxRow, 2, 1, 1, 1);
- vecControls.push_back(spinBoxRow);
- /*QLabel* labelCol = new QLabel(subWidget);
- labelCol->setObjectName(QString::fromUtf8("labelCol"));
- labelCol->setText(tr("Cow "));
- subGridLayout->addWidget(labelCol, 3, 0, 1, 1);
- vecControls.push_back(labelCol);*/
- SpinBox* spinBoxCol = new SpinBox(subWidget);
- spinBoxCol->setObjectName(QString::fromUtf8("spinBoxCol"));
- subGridLayout->addWidget(spinBoxCol, 2, 2, 1, 1);
- vecControls.push_back(spinBoxCol);
- QLabel* labelLeftTop = new QLabel(subWidget);
- 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(subWidget);
- 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);
- vecControls.push_back(doubleSpinBoxLeftTopX);
- DoubleSpinBox* doubleSpinBoxLeftTopY = new DoubleSpinBox(subWidget);
- 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);
- vecControls.push_back(doubleSpinBoxLeftTopY);
- QLabel* labelRightTopPos = new QLabel(subWidget);
- 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(subWidget);
- doubleSpinBoxRightTopX->setObjectName(QString::fromUtf8("doubleSpinBoxRightTopX"));
- doubleSpinBoxRightTopX->setFixedWidth(100); // Set fixed width to 100
- subGridLayout->addWidget(doubleSpinBoxRightTopX, 5, 1, 1, 1);
- vecControls.push_back(doubleSpinBoxRightTopX);
- DoubleSpinBox* doubleSpinBoxRightTopY = new DoubleSpinBox(subWidget);
- doubleSpinBoxRightTopY->setObjectName(QString::fromUtf8("doubleSpinBoxRightTopY"));
- doubleSpinBoxRightTopY->setFixedWidth(100); // Set fixed width to 100
- subGridLayout->addWidget(doubleSpinBoxRightTopY, 5, 2, 1, 1);
- vecControls.push_back(doubleSpinBoxRightTopY);
- QLabel* labelRightButtomPos = new QLabel(subWidget);
- 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(subWidget);
- doubleSpinBoxRightButtomX->setObjectName(QString::fromUtf8("doubleSpinBoxRightButtomX"));
- doubleSpinBoxRightButtomX->setFixedWidth(100); // Set fixed width to 100
- subGridLayout->addWidget(doubleSpinBoxRightButtomX, 6, 1, 1, 1);
- vecControls.push_back(doubleSpinBoxRightButtomX);
- DoubleSpinBox* doubleSpinBoxRightButtomY = new DoubleSpinBox(subWidget);
- doubleSpinBoxRightButtomY->setObjectName(QString::fromUtf8("doubleSpinBoxRightButtomY"));
- doubleSpinBoxRightButtomY->setFixedWidth(100); // Set fixed width to 100
- subGridLayout->addWidget(doubleSpinBoxRightButtomY, 6, 2, 1, 1);
- vecControls.push_back(doubleSpinBoxRightTopX);
- QLabel* labelNoBondPts = new QLabel(subWidget);
- 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(subWidget);
- lineEditNoBondPts->setObjectName(QString::fromUtf8("lineEditNoBondPts"));
- lineEditNoBondPts->setReadOnly(true);
- lineEditNoBondPts->setCursor(Qt::PointingHandCursor);
- lineEditNoBondPts->setProperty("vectorIndex", subVectorIndex); // 存储索引
- lineEditNoBondPts->setProperty("parentMatrixIndex", vectorIndex); // 设置父矩阵的索引
- lineEditNoBondPts->installEventFilter(this);
- subGridLayout->addWidget(lineEditNoBondPts, 7, 1, 1, 3);
- 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 = BondGetAxisPosition("UltraHead", m_vectBondMatrixs[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 = BondGetAxisPosition("UltraHead", m_vectBondMatrixs[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 = BondGetAxisPosition("UltraHead", m_vectBondMatrixs[subVectorIndex].RightBottomPoint);
- doubleSpinBoxRightButtomX->setValue(position.x); // 更新 X 轴
- doubleSpinBoxRightButtomY->setValue(position.y); // 更新 Y 轴
- });
- //layout->addLayout(subGridLayout, 11, 0);
- QFrame* line = new QFrame(subWidget);
- line->setFrameShape(QFrame::NoFrame); // 移除默认框架
- line->setFixedHeight(2); // 设置固定高度
- line->setStyleSheet("background-color: #C7CAEB;");
- subGridLayout->addWidget(line, 10, 0, 1, 4);
- layout->addWidget(subWidget);
- m_mapSubWidgetIndex.insert(subWidget, subVectorIndex);
- spinBoxRow->setValue(subMatrix.MatrixRow);
- spinBoxCol->setValue(subMatrix.MatrixCol);
- doubleSpinBoxLeftTopX->setValue(subMatrix.LeftTopPoint.x);
- doubleSpinBoxLeftTopY->setValue(subMatrix.LeftTopPoint.y);
- doubleSpinBoxRightTopX->setValue(subMatrix.RightTopPoint.x);
- doubleSpinBoxRightTopY->setValue(subMatrix.RightTopPoint.y);
- doubleSpinBoxRightButtomX->setValue(subMatrix.RightBottomPoint.x);
- doubleSpinBoxRightButtomY->setValue(subMatrix.RightBottomPoint.y);
- connect(spinBoxRow, &SpinBox::editDone, this, [=]() {
- auto it = m_mapSubWidgetIndex.find(subWidget);
- m_vecSubMatrixs[it.value()].MatrixRow = spinBoxRow->value();
- });
- connect(spinBoxCol, &SpinBox::editDone, this, [=]() {
- auto it = m_mapSubWidgetIndex.find(subWidget);
- m_vecSubMatrixs[it.value()].MatrixCol = spinBoxCol->value();
- });
- connect(doubleSpinBoxLeftTopX, &DoubleSpinBox::editDone, this, [=]() {
- auto it = m_mapSubWidgetIndex.find(subWidget);
- m_vecSubMatrixs[it.value()].LeftTopPoint.x = doubleSpinBoxLeftTopX->value();
- });
- connect(doubleSpinBoxLeftTopY, &DoubleSpinBox::editDone, this, [=]() {
- auto it = m_mapSubWidgetIndex.find(subWidget);
- m_vecSubMatrixs[it.value()].LeftTopPoint.y = doubleSpinBoxLeftTopY->value();
- });
- connect(doubleSpinBoxRightTopX, &DoubleSpinBox::editDone, this, [=]() {
- auto it = m_mapSubWidgetIndex.find(subWidget);
- m_vecSubMatrixs[it.value()].RightTopPoint.x = doubleSpinBoxRightTopX->value();
- });
- connect(doubleSpinBoxRightTopY, &DoubleSpinBox::editDone, this, [=]() {
- auto it = m_mapSubWidgetIndex.find(subWidget);
- m_vecSubMatrixs[it.value()].RightTopPoint.y = doubleSpinBoxRightTopY->value();
- });
- connect(doubleSpinBoxRightButtomX, &DoubleSpinBox::editDone, this, [=]() {
- auto it = m_mapSubWidgetIndex.find(subWidget);
- m_vecSubMatrixs[it.value()].RightBottomPoint.x = doubleSpinBoxRightButtomX->value();
- });
- connect(doubleSpinBoxRightButtomY, &DoubleSpinBox::editDone, this, [=]() {
- auto it = m_mapSubWidgetIndex.find(subWidget);
- m_vecSubMatrixs[it.value()].RightBottomPoint.y = doubleSpinBoxRightButtomY->value();
- });
- connect(lineEditNoBondPts, &QLineEdit::textChanged, this, [=]() {
- auto it = m_mapSubWidgetIndex.find(subWidget);
- });
- }
- bool BondMatrixProgramPage::eventFilter(QObject* obj, QEvent* event) {
- if (event->type() == QEvent::MouseButtonPress)
- {
- auto* lineEdit = qobject_cast<QLineEdit*>(obj);
- if (lineEdit)
- {
- int index = lineEdit->property("vectorIndex").toInt(); // 当前矩阵索引
- int parentIndex = lineEdit->property("parentMatrixIndex").toInt(); // 父矩阵索引
- onNoBondPtsClicked(lineEdit, index, parentIndex); // 传递父矩阵索引
- return true; // 拦截事件
- }
- }
- return QWidget::eventFilter(obj, event);
- }
- void BondMatrixProgramPage::onNoBondPtsClicked(QLineEdit* lineEdit, int index, int parentIndex) {
- if (parentIndex != -1)
- {
- // 处理子矩阵的操作
- if (index < 0 || index >= m_vecSubMatrixs.size()) return;
- const auto& subMatrix = m_vecSubMatrixs[index];
- NoBondPtEditDialog dlg(subMatrix.MatrixRow, subMatrix.MatrixCol, subMatrix.VecNoBondPt, this);
- if (dlg.exec() == QDialog::Accepted)
- {
- QVector<XY_LONG_STRUCT> selected = dlg.getSelectedPoints();
- m_vecSubMatrixs[index].VecNoBondPt = 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(" "));
- }
- // 这里可以用 parentIndex 来关联父矩阵(即大矩阵)做相应的操作
- }
- else
- {
- // 处理大矩阵的操作
- if (index < 0 || index >= m_vectBondMatrixs.size()) return;
- const auto& bondMatrix = m_vectBondMatrixs[index];
- NoBondPtEditDialog dlg(bondMatrix.BondMatrixRow, bondMatrix.BondMatrixCol, bondMatrix.VecNoBondPt, this);
- if (dlg.exec() == QDialog::Accepted)
- {
- QVector<XY_LONG_STRUCT> selected = dlg.getSelectedPoints();
- m_vectBondMatrixs[index].VecNoBondPt = 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(" "));
- }
- // 这里也可以用 parentIndex 来关联父矩阵(即大矩阵)做相应的操作
- }
- }
- void BondMatrixProgramPage::AddMatrixParam()
- {
- }
- void BondMatrixProgramPage::UpdatePageParam()
- {
- int dieSourceIndex = 0;
- if (m_curBondInfo.eDieSource == DIE_SOURCE::BY_WAFER)
- {
- dieSourceIndex = 1;
- }
- else if (m_curBondInfo.eDieSource == DIE_SOURCE::BY_WAFFLE)
- {
- dieSourceIndex = 0;
- }
- ui.comboBoxDieSource->setCurrentIndex(dieSourceIndex);
- ui.spinBoxPickTempID->setValue(m_curBondInfo.iPickPRStrategyId);
- ui.spinBoxPickNozzleID->setValue(m_curBondInfo.iPickHeadId);
- ui.spinBoxPreBondTemp->setValue(m_curBondInfo.iBondFrontPRStrategyId);
- ui.spinBoxPostBondTemp->setValue(m_curBondInfo.iBondBackPRStrategyId);
- ui.spinBoxBondTemp->setValue(m_curBondInfo.iBondPRStrategyId);
- ui.spinBoxLookUpTemp->setValue(m_curBondInfo.iLookUpPRStrategyId);
- ui.spinBoxCalibPickTemp->setValue(m_curBondInfo.iCalibPRStrategyId);
- ui.doubleSpinBoxBondOffsetX->setValue(m_curBondInfo.stOffset.x);
- ui.doubleSpinBoxBondOffsetY->setValue(m_curBondInfo.stOffset.y);
- ui.doubleSpinBoxBondOffsetAngle->setValue(m_curBondInfo.stOffset.a);
- UpdatePagePickParam();
- UpdatePageBondParam();
- }
- void BondMatrixProgramPage::ParamChangeEvent()
- {
- m_manageDB->GetCProduct()->SetBondInfoData(m_curBondInfo.iInfoId, m_curBondInfo);
- m_manageDB->GetCProduct()->SetBondParam(m_curWaferPickParam.iId, m_curWaferPickParam);
- m_manageDB->GetCProduct()->SetBondParam(m_curCalibPlaceParam.iId, m_curCalibPlaceParam);
- m_manageDB->GetCProduct()->SetBondParam(m_curCalibPickParam.iId, m_curCalibPickParam);
- m_manageDB->GetCProduct()->SetBondParam(m_curBondParam.iId, m_curBondParam);
- CProduct* _Product = m_manageDB->GetCProduct();
- }
- void BondMatrixProgramPage::MatrixChangeEvent()
- {
- m_manageDB->GetCProduct()->SetAllBondMatrix(m_vectBondMatrixs, true);
- m_manageDB->GetCProduct()->SetAllPointMatrix(m_vecSubMatrixs, true);
- /*for (PROGRAM_BOND_MATRIX_STRUCT& bondMatrix : m_vectBondMatrixs)
- {
- m_manageDB->GetCProduct()->SetBondMatrix(bondMatrix.BondMatrixId, bondMatrix);
- }*/
- /*for (PROGRAM_POINT_MATRIX_STRUCT& pointMatrix : m_vecSubMatrixs)
- {
- m_manageDB->GetCProduct()->SetPointMatrix(pointMatrix.MatrixId, pointMatrix);
- }*/
- CProduct* _Product = m_manageDB->GetCProduct();
- }
- void BondMatrixProgramPage::UpdatePagePickParam()
- {
- //"取晶头取晶"
- if (ui.comboBoxPickParamType->currentIndex() == 0)
- {
- ui.checkBoxPickBlockCheck->setChecked(m_curWaferPickParam.bCheckBlock);
- ui.checkBoxPickLoseCheck->setChecked(m_curWaferPickParam.bCheckLose);
- ui.checkBoxPickFindForceCheck->setChecked(m_curWaferPickParam.bFindForce);
- ui.doubleSpinBoxPrePickZ->setValue(m_curWaferPickParam.dPreLev);
- ui.doubleSpinBoxPickForce->setValue(m_curWaferPickParam.dForce);
- ui.doubleSpinBoxPickPosZ->setValue(m_curWaferPickParam.dWorkLev);
- ui.spinBoxPickGrabDelay->setValue(m_curWaferPickParam.iGrabDelay);
- ui.spinBox_PickDelay->setValue(m_curWaferPickParam.iPickOrBondDelay);
- ui.spinBoxPickBlockCheckDelay->setValue(m_curWaferPickParam.iBlockOrLoseDelay);
- ui.spinBoxPickVacDelay->setValue(m_curWaferPickParam.iVacuumDelay);
- ui.spinBoxPickBlowDelay->setValue(m_curWaferPickParam.iBlowDelay);
- }
- //"中转台取晶"
- else if (ui.comboBoxPickParamType->currentIndex() == 1)
- {
- ui.checkBoxPickBlockCheck->setChecked(m_curCalibPickParam.bCheckBlock);
- ui.checkBoxPickLoseCheck->setChecked(m_curCalibPickParam.bCheckLose);
- ui.checkBoxPickFindForceCheck->setChecked(m_curCalibPickParam.bFindForce);
- ui.doubleSpinBoxPrePickZ->setValue(m_curCalibPickParam.dPreLev);
- ui.doubleSpinBoxPickForce->setValue(m_curCalibPickParam.dForce);
- ui.doubleSpinBoxPickPosZ->setValue(m_curCalibPickParam.dWorkLev);
- ui.spinBoxPickGrabDelay->setValue(m_curCalibPickParam.iGrabDelay);
- ui.spinBox_PickDelay->setValue(m_curCalibPickParam.iPickOrBondDelay);
- ui.spinBoxPickBlockCheckDelay->setValue(m_curCalibPickParam.iBlockOrLoseDelay);
- ui.spinBoxPickVacDelay->setValue(m_curCalibPickParam.iVacuumDelay);
- ui.spinBoxPickBlowDelay->setValue(m_curCalibPickParam.iBlowDelay);
- }
- }
- void BondMatrixProgramPage::UpdatePageBondParam()
- {
- //"中转台放晶"
- if (ui.comboBoxBondParamType->currentIndex() == 0)
- {
- ui.checkBoxBondBlockCheck->setChecked(m_curCalibPlaceParam.bCheckBlock);
- ui.checkBoxBondLoseCheck->setChecked(m_curCalibPlaceParam.bCheckLose);
- ui.checkBoxBondFindForce->setChecked(m_curCalibPlaceParam.bFindForce);
- ui.doubleSpinBoxPreBondPosZ->setValue(m_curCalibPlaceParam.dPreLev);
- ui.doubleSpinBoxBondForce->setValue(m_curCalibPlaceParam.dForce);
- ui.doubleSpinBoxBondPosZ->setValue(m_curCalibPlaceParam.dWorkLev);
- ui.spinBoxBondGrabDelay->setValue(m_curCalibPlaceParam.iGrabDelay);
- ui.spinBoxBondDelay->setValue(m_curCalibPlaceParam.iPickOrBondDelay);
- ui.spinBoxBondBlockCheckDelay->setValue(m_curCalibPlaceParam.iBlockOrLoseDelay);
- ui.spinBoxBondVacDelay->setValue(m_curCalibPlaceParam.iVacuumDelay);
- ui.spinBoxBondBlowDelay->setValue(m_curCalibPlaceParam.iBlowDelay);
- }
- //"固晶台固晶"
- else if (ui.comboBoxBondParamType->currentIndex() == 1)
- {
- ui.checkBoxBondBlockCheck->setChecked(m_curBondParam.bCheckBlock);
- ui.checkBoxBondLoseCheck->setChecked(m_curBondParam.bCheckLose);
- ui.checkBoxBondFindForce->setChecked(m_curBondParam.bFindForce);
- ui.doubleSpinBoxPreBondPosZ->setValue(m_curBondParam.dPreLev);
- ui.doubleSpinBoxBondForce->setValue(m_curBondParam.dForce);
- ui.doubleSpinBoxBondPosZ->setValue(m_curBondParam.dWorkLev);
- ui.spinBoxBondGrabDelay->setValue(m_curBondParam.iGrabDelay);
- ui.spinBoxBondDelay->setValue(m_curBondParam.iPickOrBondDelay);
- ui.spinBoxBondBlockCheckDelay->setValue(m_curBondParam.iBlockOrLoseDelay);
- ui.spinBoxBondVacDelay->setValue(m_curBondParam.iVacuumDelay);
- ui.spinBoxBondBlowDelay->setValue(m_curBondParam.iBlowDelay);
- }
- }
- void BondMatrixProgramPage::initPage()
- {
- if (m_manageDB == nullptr)
- {
- return;
- }
- //从后端获取数据
- m_vectBondMatrixs = m_manageDB->GetCProduct()->GetBondMatrix();
- m_manageDB->GetCProduct()->GetAllPointMatrix(m_vecSubMatrixs);
- if (m_vectBondMatrixs.size() == 0)
- {
- return;
- }
- //for (int i = 0; i < m_vectBondMatrixs.size(); i++)
- //{
- // for (int j = 0; j < m_vectBondMatrixs[i].VecPointMatrixId.size(); j++)
- // {
- // PROGRAM_POINT_MATRIX_STRUCT subMatrix;
- // m_manageDB->GetCProduct()->GetPointMatrix(m_vectBondMatrixs[i].VecPointMatrixId[j], subMatrix);
- // m_vecSubMatrixs.push_back(subMatrix);
- // //AddMatrixPage(i, j, subMatrix);
- // }
- // AddOutMatrixPage(i, m_vectBondMatrixs[i], m_vecSubMatrixs);
- //}
- for (int i = 0; i < m_vectBondMatrixs.size(); i++)
- {
- AddOutMatrixPage(i, m_vectBondMatrixs[i], m_vecSubMatrixs);
- }
- //for (int i = 0; i < m_vectBondMatrixs[0].VecPointMatrixId.size(); ++i)
- //{
- // PROGRAM_POINT_MATRIX_STRUCT subMatrix;
- // m_manageDB->GetCProduct()->GetPointMatrix(m_vectBondMatrixs[0].VecPointMatrixId[i], subMatrix);
- // m_vecSubMatrixs.push_back(subMatrix);
- //}
- //m_manageDB->GetCProduct()->GetDieMatrix(m_vectBondMatrixs[0].VecPointMatrixId[0], m_vecSubMatrixs);
- //显示矩阵数据
- /*ui.spinBoxRow->setValue(m_vectBondMatrixs[0].BondMatrixRow);
- ui.spinBoxCol->setValue(m_vectBondMatrixs[0].BondMatrixCol);
- ui.doubleSpinBoxLeftTopX->setValue(m_vectBondMatrixs[0].LeftTopPoint.x);
- ui.doubleSpinBoxLeftTopY->setValue(m_vectBondMatrixs[0].LeftTopPoint.y);
- ui.doubleSpinBoxRightTopX->setValue(m_vectBondMatrixs[0].RightTopPoint.x);
- ui.doubleSpinBoxRightTopY->setValue(m_vectBondMatrixs[0].RightTopPoint.y);
- ui.doubleSpinBoxRightButtomX->setValue(m_vectBondMatrixs[0].RightBottomPoint.x);
- ui.doubleSpinBoxRightButtomY->setValue(m_vectBondMatrixs[0].RightBottomPoint.y);
- QString noBondPts = "";
- bool firstTime = false;
- for (XY_LONG_STRUCT& pt : m_vectBondMatrixs[0].VecNoBondPt)
- {
- if (firstTime)
- {
- noBondPts += "(" + QString::number(pt.x) + "," + QString::number(pt.y) + ")";
- firstTime = true;
- }
- noBondPts += ";(" + QString::number(pt.x) + "," + QString::number(pt.y) + ")";
- }
- ui.lineEditNoBondPts->setText(noBondPts);*/
- //显示子矩阵及数据
- //for (PROGRAM_POINT_MATRIX_STRUCT& subMatrix : m_vecSubMatrixs)
- //{
- // AddMatrixPage(subMatrix);
- //}
- //从后端获取参数, 一套数据
- CResources* pResources = CResources::GetInstance();
- if (pResources == nullptr)
- {
- return;
- }
- CBondMatrix* pBondMatrix = pResources->GetBondMatrix();
- if (pBondMatrix == nullptr)
- {
- return;
- }
- //pBondMatrix->GetPintInfoByIndex(0, m_curPointInfo);
- m_manageDB->GetCProduct()->GetBondInfoData(m_vectBondMatrixs[0].BondInfoId, m_curBondInfo);
- m_manageDB->GetCProduct()->GetBondParam(m_curBondInfo.iPickParamId, m_curWaferPickParam);
- m_manageDB->GetCProduct()->GetBondParam(m_curBondInfo.iCalibBondParamId, m_curCalibPlaceParam);
- m_manageDB->GetCProduct()->GetBondParam(m_curBondInfo.iCalibPickParamId, m_curCalibPickParam);
- m_manageDB->GetCProduct()->GetBondParam(m_curBondInfo.iBondParamId, m_curBondParam);
- //显示界面参数
- UpdatePageParam();
- }
|