#include "expertsmartpointsetwin.h" #include #include #include #include #include #include #include ExpertSmartPointSetWin::ExpertSmartPointSetWin(QWidget *parent) : BaseWin{parent} { setWindowModality(Qt::WindowModal); setAttribute(Qt::WA_DeleteOnClose); setWindowTitle("智能走点参数配置"); resize(900, 600); auto vBox = new QVBoxLayout(center); vBox->setContentsMargins(0,0,0,0); vBox->setSpacing(3); vBox->addLayout(addBtns(new QHBoxLayout())); auto stack = new QStackedLayout; vBox->addLayout(stack); auto page = new QWidget; stack->addWidget(page); QPalette bkBlue; { auto vBox = new QVBoxLayout(page); vBox->setContentsMargins(50, 50, 6, 6); auto lb = new QLabel("基本参数"); bkBlue = lb->palette(); bkBlue.setColor(QPalette::WindowText, QColor(0x5599ff)); lb->setPalette(bkBlue); vBox->addWidget(lb); vBox->addSpacing(50); auto hBox = new QHBoxLayout; hBox->addStretch(); { auto vvv = new QVBoxLayout; auto hhhh = new QHBoxLayout; lb = new QLabel("模组宽度: "); hhhh->addWidget(lb); fdModuleWidth = new QSpinBox; fdModuleWidth->setRange(0, 9999); fdModuleWidth->setValue(128); hhhh->addWidget(fdModuleWidth); vvv->addLayout(hhhh); vvv->addSpacing(30); hhhh = new QHBoxLayout; lb = new QLabel("模组高度: "); hhhh->addWidget(lb); fdModuleHeight = new QSpinBox; fdModuleHeight->setRange(0, 9999); fdModuleHeight->setValue(64); hhhh->addWidget(fdModuleHeight); vvv->addLayout(hhhh); vvv->addSpacing(30); hhhh = new QHBoxLayout; lb = new QLabel("数据组数: "); hhhh->addWidget(lb); auto fdGrpCnt = new QSpinBox; fdGrpCnt->setRange(0, 9999); fdGrpCnt->setValue(1); hhhh->addWidget(fdGrpCnt); vvv->addLayout(hhhh); vvv->addStretch(); hBox->addLayout(vvv); } hBox->addStretch(); { auto vvv = new QVBoxLayout; auto hhhh = new QHBoxLayout; lb = new QLabel("驱动芯片: "); hhhh->addWidget(lb); auto fdChip = new QComboBox; fdChip->addItem("ICND2153"); hhhh->addWidget(fdChip); vvv->addLayout(hhhh); vvv->addSpacing(30); hhhh = new QHBoxLayout; lb = new QLabel("译码方式: "); hhhh->addWidget(lb); auto fdDecodeMode = new QComboBox; fdDecodeMode->addItem("138译码"); hhhh->addWidget(fdDecodeMode); vvv->addLayout(hhhh); vvv->addSpacing(30); hhhh = new QHBoxLayout; lb = new QLabel("分组方式: "); hhhh->addWidget(lb); auto fdGrping = new QComboBox; fdGrping->addItem("三线并行"); fdGrping->addItem("三色1点串"); fdGrping->addItem("三色8点串"); fdGrping->addItem("三色16点串"); hhhh->addWidget(fdGrping); vvv->addLayout(hhhh); vvv->addStretch(); hBox->addLayout(vvv); } hBox->addStretch(); vBox->addLayout(hBox); } page = new QWidget; stack->addWidget(page); { auto vBox = new QVBoxLayout(page); vBox->setContentsMargins(50, 50, 6, 6); auto lb = new QLabel("扫描行数"); lb->setPalette(bkBlue); vBox->addWidget(lb); vBox->addSpacing(50); auto hBox = new QHBoxLayout; vBox->addLayout(hBox); hBox->addStretch(); auto vvv = new QVBoxLayout; hBox->addLayout(vvv); lb = new QLabel("根据亮线的行/列数确定扫描行/列数: "); vvv->addWidget(lb); vvv->addSpacing(30); auto hhhh = new QHBoxLayout; hhhh->addStretch(); auto fdRow = new QRadioButton("行"); hhhh->addWidget(fdRow); hhhh->addStretch(); auto fdCol = new QRadioButton("列"); hhhh->addWidget(fdCol); hhhh->addStretch(); vvv->addLayout(hhhh); vvv->addSpacing(20); hhhh = new QHBoxLayout; hhhh->addStretch(); lb = new QLabel("亮线的行/列数: "); hhhh->addWidget(lb); auto fdNum = new QSpinBox; fdNum->setRange(0, 9999); fdNum->setValue(1); hhhh->addWidget(fdNum); hhhh->addStretch(); vvv->addLayout(hhhh); vvv->addStretch(); hBox->addStretch(); vvv = new QVBoxLayout; hBox->addLayout(vvv); lb = new QLabel("芯片245版本: "); vvv->addWidget(lb); vvv->addSpacing(30); hhhh = new QHBoxLayout; hhhh->addStretch(); auto fdA = new QRadioButton("A"); hhhh->addWidget(fdA); hhhh->addStretch(); auto fdD = new QRadioButton("D"); hhhh->addWidget(fdD); hhhh->addStretch(); vvv->addLayout(hhhh); vvv->addStretch(); hBox->addStretch(); } page = new QWidget; stack->addWidget(page); { auto vBox = new QVBoxLayout(page); vBox->setContentsMargins(50, 50, 6, 6); auto lb = new QLabel("数据线颜色"); lb->setPalette(bkBlue); vBox->addWidget(lb); vBox->addSpacing(50); lb = new QLabel("依次点击以下状态, 根据模组颜色选择对应颜色"); vBox->addWidget(lb, 0, Qt::AlignCenter); vBox->addSpacing(30); auto hhhh = new QHBoxLayout; hhhh->addStretch(); auto fdSta1 = new QRadioButton("状态1"); hhhh->addWidget(fdSta1); hhhh->addStretch(); auto fdR1 = new QRadioButton("红"); hhhh->addWidget(fdR1); hhhh->addSpacing(20); auto fdG1 = new QRadioButton("绿"); hhhh->addWidget(fdG1); hhhh->addSpacing(20); auto fdB1 = new QRadioButton("蓝"); hhhh->addWidget(fdB1); hhhh->addSpacing(20); auto fdNo1 = new QRadioButton("黑"); hhhh->addWidget(fdNo1); hhhh->addStretch(); vBox->addLayout(hhhh); vBox->addSpacing(20); hhhh = new QHBoxLayout; hhhh->addStretch(); auto fdSta2 = new QRadioButton("状态2"); hhhh->addWidget(fdSta2); hhhh->addStretch(); auto fdR2 = new QRadioButton("红"); hhhh->addWidget(fdR2); hhhh->addSpacing(20); auto fdG2 = new QRadioButton("绿"); hhhh->addWidget(fdG2); hhhh->addSpacing(20); auto fdB2 = new QRadioButton("蓝"); hhhh->addWidget(fdB2); hhhh->addSpacing(20); auto fdNo2 = new QRadioButton("黑"); hhhh->addWidget(fdNo2); hhhh->addStretch(); vBox->addLayout(hhhh); vBox->addSpacing(20); hhhh = new QHBoxLayout; hhhh->addStretch(); auto fdSta3 = new QRadioButton("状态3"); hhhh->addWidget(fdSta3); hhhh->addStretch(); auto fdR3 = new QRadioButton("红"); hhhh->addWidget(fdR3); hhhh->addSpacing(20); auto fdG3 = new QRadioButton("绿"); hhhh->addWidget(fdG3); hhhh->addSpacing(20); auto fdB3 = new QRadioButton("蓝"); hhhh->addWidget(fdB3); hhhh->addSpacing(20); auto fdNo3 = new QRadioButton("黑"); hhhh->addWidget(fdNo3); hhhh->addStretch(); vBox->addLayout(hhhh); vBox->addStretch(); auto btnGrp = new QButtonGroup(page); btnGrp->addButton(fdR1); btnGrp->addButton(fdG1); btnGrp->addButton(fdB1); btnGrp->addButton(fdNo1); btnGrp = new QButtonGroup(page); btnGrp->addButton(fdR2); btnGrp->addButton(fdG2); btnGrp->addButton(fdB2); btnGrp->addButton(fdNo2); btnGrp = new QButtonGroup(page); btnGrp->addButton(fdR3); btnGrp->addButton(fdG3); btnGrp->addButton(fdB3); btnGrp->addButton(fdNo3); } page = new QWidget; stack->addWidget(page); { auto vBox = new QVBoxLayout(page); vBox->setContentsMargins(0,0,0,0); auto hhh = new QHBoxLayout; auto bnReset = new QPushButton("重新走点"); bnReset->setMinimumSize(90, 30); connect(bnReset, &QPushButton::clicked, this, [this] { table->clearContents(); curPoint = 0; }); hhh->addWidget(bnReset); hhh->addStretch(); vBox->addLayout(hhh); table = new PointTable; table->setEditTriggers(QAbstractItemView::NoEditTriggers); table->horizontalHeader()->setDefaultSectionSize(40); table->horizontalHeader()->setDefaultAlignment(Qt::AlignCenter); table->verticalHeader()->setMinimumWidth(40); table->verticalHeader()->setDefaultAlignment(Qt::AlignCenter); table->setSelectionMode(QTableWidget::SingleSelection); connect(table, &QTableWidget::currentCellChanged, this, [this](int currentRow, int currentColumn) { auto item = table->item(currentRow, currentColumn); if(! item) table->setItem(currentRow, currentColumn, new QTableWidgetItem(QString::number(++curPoint))); }); vBox->addWidget(table); } auto hBox = new QHBoxLayout; vBox->addLayout(hBox); hBox->addStretch(); auto btnPrev = new QPushButton("上一步"); btnPrev->setMinimumSize(90, 30); hBox->addWidget(btnPrev); auto btnNext = new QPushButton("下一步"); btnNext->setMinimumSize(90, 30); hBox->addWidget(btnNext); connect(btnPrev, &QPushButton::clicked, this, [stack, btnPrev, btnNext] { auto idx = stack->currentIndex(); stack->setCurrentIndex(--idx); btnPrev->setVisible(idx > 0); btnNext->setVisible(idx < stack->count()-1); }); connect(btnNext, &QPushButton::clicked, this, [this, stack, btnPrev, btnNext] { auto idx = stack->currentIndex(); if(idx==0) { moduleWidth = fdModuleWidth->value(); moduleHeight = fdModuleHeight->value(); } else if(idx==2) { table->setColumnCount(moduleWidth); table->setRowCount(moduleHeight); } stack->setCurrentIndex(++idx); btnPrev->setVisible(idx > 0); btnNext->setVisible(idx < stack->count()-1); }); auto btnCcl = new QPushButton("取消"); btnCcl->setMinimumSize(90, 30); hBox->addWidget(btnCcl); hBox->addSpacing(30); }