2022-08-25 18:43:03 +08:00
|
|
|
#include "mainwin.h"
|
|
|
|
#include "fast.h"
|
|
|
|
#include "expertwin.h"
|
|
|
|
#include "brightwin.h"
|
|
|
|
#include "pcapwin.h"
|
|
|
|
#include "gqt.h"
|
2022-08-30 23:07:13 +08:00
|
|
|
#include <QLabel>
|
2022-08-25 18:43:03 +08:00
|
|
|
#include <QPushButton>
|
|
|
|
#include <QToolButton>
|
|
|
|
#include <QComboBox>
|
|
|
|
#include <QMouseEvent>
|
|
|
|
#include <QPainter>
|
|
|
|
#include <QPainterPath>
|
|
|
|
#include <QTimer>
|
2022-08-30 23:07:13 +08:00
|
|
|
|
2022-08-25 18:43:03 +08:00
|
|
|
class ImgBtn : public QToolButton {
|
|
|
|
public:
|
|
|
|
ImgBtn(QIcon icon) {
|
|
|
|
setIcon(icon);
|
|
|
|
setStyleSheet("QToolButton{border: none;}");
|
|
|
|
}
|
|
|
|
protected:
|
|
|
|
void enterEvent(QEvent *) override {
|
|
|
|
setStyleSheet("QToolButton{border: none;}");
|
|
|
|
setIconSize(QSize(width(), width()));
|
|
|
|
}
|
|
|
|
void leaveEvent(QEvent *) override {
|
|
|
|
setIconSize(QSize(width()-8, width()-8));
|
|
|
|
setStyleSheet("QToolButton{border: none; padding-top: 4px;}");
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
inline QLabel *newImgLabel(QPixmap pixmap){
|
|
|
|
QLabel *lb = new QLabel();
|
|
|
|
lb->setPixmap(pixmap);
|
|
|
|
return lb;
|
|
|
|
}
|
|
|
|
inline QLabel *newSubLabel(QString txt){
|
|
|
|
QLabel *lb = new QLabel(txt);
|
|
|
|
lb->setAlignment(Qt::AlignCenter);
|
|
|
|
return lb;
|
|
|
|
}
|
|
|
|
void addImg(QHBoxLayout *parent, ImgBtn* imgBtn, QString txt) {
|
|
|
|
imgBtn->setText(txt);
|
|
|
|
imgBtn->setFixedSize(76, 100);
|
|
|
|
imgBtn->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
|
|
|
|
imgBtn->setIconSize(QSize(76, 76));
|
|
|
|
parent->addWidget(imgBtn);
|
|
|
|
}
|
|
|
|
|
|
|
|
MainWin::MainWin() {
|
|
|
|
setWindowTitle("Led Set");
|
|
|
|
resize(860, 540);
|
|
|
|
|
|
|
|
auto vBox = new QVBoxLayout(center);
|
|
|
|
vBox->setContentsMargins(0,0,0,0);
|
|
|
|
|
|
|
|
vBox->addLayout(addBtns(new QHBoxLayout()));
|
|
|
|
|
|
|
|
QHBoxLayout *imgsBar = new QHBoxLayout();
|
|
|
|
ImgBtn *btnImg;
|
|
|
|
addImg(imgsBar, btnImg = new ImgBtn(QPixmap(":/imgs/fast.png").scaledToWidth(128, Qt::SmoothTransformation)), "快速调屏");
|
|
|
|
connect(btnImg, &ImgBtn::clicked, this, [=](){
|
|
|
|
(new Fast(this))->show();
|
|
|
|
// if(win==0) {
|
|
|
|
// win = new QWidget;
|
|
|
|
// win->setWindowFlag(Qt::FramelessWindowHint);
|
|
|
|
// win->resize(600,100);
|
|
|
|
// win->show();
|
|
|
|
// } else {
|
|
|
|
// win->move(win->x()-100, win->y());
|
|
|
|
// }
|
|
|
|
});
|
|
|
|
addImg(imgsBar, btnImg = new ImgBtn(QPixmap(":/imgs/expert.png").scaledToWidth(128, Qt::SmoothTransformation)), "专家调屏");
|
|
|
|
connect(btnImg, &ImgBtn::clicked, this, [=](){
|
|
|
|
(new ExpertWin(this))->show();
|
|
|
|
});
|
|
|
|
addImg(imgsBar, btnImg = new ImgBtn(QPixmap(":/imgs/bright.png").scaledToWidth(128, Qt::SmoothTransformation)), "亮度控制");
|
|
|
|
connect(btnImg, &ImgBtn::clicked, this, [=](){
|
|
|
|
(new BrightWin(this))->show();
|
|
|
|
});
|
|
|
|
addImg(imgsBar, btnImg = new ImgBtn(QPixmap(":/imgs/correct.png").scaledToWidth(128, Qt::SmoothTransformation)), "相机矫正");
|
|
|
|
connect(btnImg, &ImgBtn::clicked, this, [=](){
|
|
|
|
|
|
|
|
});
|
|
|
|
addImg(imgsBar, btnImg = new ImgBtn(QPixmap(":/imgs/monitor.png").scaledToWidth(128, Qt::SmoothTransformation)), "屏体监控");
|
|
|
|
connect(btnImg, &ImgBtn::clicked, this, [=](){
|
|
|
|
|
|
|
|
});
|
|
|
|
addImg(imgsBar, btnImg = new ImgBtn(QPixmap(":/imgs/multi.png").scaledToWidth(128, Qt::SmoothTransformation)), "多功能卡");
|
|
|
|
connect(btnImg, &ImgBtn::clicked, this, [=](){
|
|
|
|
//win->move(win->x()-1, win->y());
|
|
|
|
});
|
|
|
|
addImg(imgsBar, btnImg = new ImgBtn(QPixmap(":/imgs/video.png").scaledToWidth(128, Qt::SmoothTransformation)), "网口通信");
|
|
|
|
connect(btnImg, &ImgBtn::clicked, this, [=](){
|
|
|
|
auto ins = PcapWin::newIns(this);
|
|
|
|
if(ins) ins->show();
|
|
|
|
});
|
|
|
|
addImg(imgsBar, btnImg = new ImgBtn(QPixmap(":/imgs/idea.png").scaledToWidth(128, Qt::SmoothTransformation)), "创意显示");
|
|
|
|
connect(btnImg, &ImgBtn::clicked, this, [=](){
|
|
|
|
//qDebug()<<"geometry"<<win->geometry()<<"screen"<<win->screen();
|
|
|
|
});
|
|
|
|
vBox->addLayout(imgsBar);
|
|
|
|
|
|
|
|
vBox->addSpacing(16);
|
|
|
|
vBox->addWidget(new QLabel(" 硬件信息"));
|
|
|
|
|
|
|
|
|
|
|
|
vBox->addStretch();
|
|
|
|
}
|