增加智能走点设置

This commit is contained in:
gangphon 2022-08-25 22:52:52 +08:00
parent 5e68b7c2a9
commit ab22d10c41
4 changed files with 206 additions and 11 deletions

View File

@ -2,9 +2,11 @@
#include <QStackedLayout>
#include <QLabel>
#include <QRadioButton>
#include <QSpinBox>
#include <QPushButton>
#include <QButtonGroup>
#include <QComboBox>
#include <QHeaderView>
ExpertSmartPointSetWin::ExpertSmartPointSetWin(QWidget *parent) : BaseWin{parent} {
setWindowModality(Qt::WindowModal);
@ -22,10 +24,115 @@ ExpertSmartPointSetWin::ExpertSmartPointSetWin(QWidget *parent) : BaseWin{parent
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);
@ -94,8 +201,10 @@ ExpertSmartPointSetWin::ExpertSmartPointSetWin(QWidget *parent) : BaseWin{parent
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);
@ -195,6 +304,43 @@ ExpertSmartPointSetWin::ExpertSmartPointSetWin(QWidget *parent) : BaseWin{parent
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->setColumnCount(0);
table->setRowCount(0);
table->setColumnCount(moduleWidth);
table->setRowCount(moduleHeight);
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);
@ -209,14 +355,21 @@ ExpertSmartPointSetWin::ExpertSmartPointSetWin(QWidget *parent) : BaseWin{parent
hBox->addWidget(btnNext);
connect(btnPrev, &QPushButton::clicked, this, [stack, btnPrev, btnNext] {
auto idx = stack->currentIndex()-1;
stack->setCurrentIndex(idx);
auto idx = stack->currentIndex();
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);
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);
});

View File

@ -2,11 +2,27 @@
#define EXPERTSMARTPOINTSETWIN_H
#include "basewin.h"
#include <QSpinBox>
#include <QTableWidget>
class PointTable : public QTableWidget {
public:
explicit PointTable(QWidget *parent = nullptr) : QTableWidget{parent} {}
void setItem(int row, int column, QTableWidgetItem *item) {
if(item) item->setTextAlignment(Qt::AlignCenter);
QTableWidget::setItem(row, column, item);
}
};
class ExpertSmartPointSetWin : public BaseWin {
Q_OBJECT
public:
explicit ExpertSmartPointSetWin(QWidget *parent = nullptr);
QSpinBox *fdModuleWidth, *fdModuleHeight;
PointTable *table;
int moduleWidth{0}, moduleHeight{0};
int curPoint{0};
};
#endif // EXPERTSMARTPOINTSETWIN_H

View File

@ -122,8 +122,6 @@ QTabBar::tab:selected {margin-top: 0; border-bottom: none; color: #acf; backgrou
}
}
@ -224,4 +222,29 @@ QTabBar::tab:selected {margin-top: 0; border-bottom: none; color: #acf; backgrou
vBox->addStretch();
}
auto connPanel = new QWidget;
tab->addTab(connPanel, "显示屏连接(正面看屏)");
{
auto vBox = new QVBoxLayout(connPanel);
vBox->setContentsMargins(4, 4, 4, 4);
auto hhh = new QHBoxLayout;
vBox->addLayout(hhh);
auto bnScreen = new QPushButton("屏1");
hhh->addWidget(bnScreen);
hhh->addStretch();
auto lb = new QLabel("显示屏数目:");
hhh->addWidget(lb);
auto fdScreenCnt = new QSpinBox;
fdScreenCnt->setRange(1, 99);
fdScreenCnt->setValue(1);
hhh->addWidget(fdScreenCnt);
vBox->addStretch();
}
}

View File

@ -63,11 +63,13 @@ int main(int argc, char *argv[]) {
QMessageBox {background: #444;}
QGroupBox::title {color: #fff;}
QPushButton, QLineEdit, QSpinBox, QAbstractScrollArea {border: 1px solid #888;}
QPushButton{border-radius: 4px; padding: 2px 6px; background: #222; color: #fff;}
QLineEdit, QComboBox, QSpinBox, QPushButton, QAbstractScrollArea {border: 1px solid #888;}
QLineEdit, QComboBox, QSpinBox {border-radius: 2px; padding: 2px; background: #222;}
QPushButton{border-radius: 4px; padding: 2px 6px; background: #222;}
QPushButton:hover {background: #444;}
QPushButton:pressed {background: #666;}
QLineEdit, QSpinBox{border-radius: 2px; padding: 2px; background: #222; color: #fff;}
QPushButton[ss="min"]{border-radius: 4px; padding: 0; width: 30px; height: 25px; background: #07c;}
QPushButton[ss="close"]{border-radius: 4px; padding: 0; width: 30px; height: 25px; background: #e22;}
@ -76,6 +78,7 @@ QRadioButton::indicator:checked {border-image: url(:/imgs/radio-check.png);}
QAbstractScrollArea QScrollBar {background: #555;}
QTableView {gridline-color:#888;}
QHeaderView::section, QTableCornerButton:section {background: #555;}
QSlider::horizontal {height: 16px;}