qt/ledset/expertsmartpointsetwin.cpp
2022-08-25 18:43:03 +08:00

230 lines
6.1 KiB
C++

#include "expertsmartpointsetwin.h"
#include <QStackedLayout>
#include <QLabel>
#include <QRadioButton>
#include <QSpinBox>
#include <QPushButton>
#include <QButtonGroup>
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);
{
auto vBox = new QVBoxLayout(page);
auto lb = new QLabel("扫描行数");
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);
auto lb = new QLabel("数据线颜色");
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);
}
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()-1;
stack->setCurrentIndex(idx);
btnPrev->setVisible(idx > 0);
btnNext->setVisible(idx < stack->count()-1);
});
connect(btnNext, &QPushButton::clicked, this, [stack, btnPrev, btnNext] {
auto idx = stack->currentIndex()+1;
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);
}