171 lines
4.2 KiB
C++
171 lines
4.2 KiB
C++
#include <qmutex.h>
|
|||
|
|
#include <qlabel.h>
|
||
|
|
#include <qlayout.h>
|
||
|
|
class perCpkWidget :public QWidget
|
||
|
|
{
|
||
|
|
QVBoxLayout* layout;
|
||
|
|
QLabel* cpkSizeData;
|
||
|
|
QLabel* title;
|
||
|
|
QWidget* calwidget;
|
||
|
|
double USL=1,avg=1;
|
||
|
|
public:
|
||
|
|
perCpkWidget(QString Name)
|
||
|
|
{
|
||
|
|
this->setObjectName("perCpkWidget");
|
||
|
|
this->setStyleSheet("QWidget#perCpkWidget {"
|
||
|
|
" border: 1px solid white;"
|
||
|
|
" border-radius: 10px;"
|
||
|
|
"}");
|
||
|
|
layout = new QVBoxLayout(this);
|
||
|
|
layout->setAlignment(Qt::AlignTop);
|
||
|
|
|
||
|
|
title = new QLabel(Name);
|
||
|
|
QFont font("微软雅黑", 14, QFont::Bold);
|
||
|
|
title->setFont(font);
|
||
|
|
QPalette palette;
|
||
|
|
palette.setColor(QPalette::WindowText, Qt::white);
|
||
|
|
title->setPalette(palette);
|
||
|
|
title->setAlignment(Qt::AlignCenter);
|
||
|
|
title->setFixedHeight(40);
|
||
|
|
|
||
|
|
layout->addWidget(title);
|
||
|
|
|
||
|
|
calwidget = new QWidget();
|
||
|
|
QHBoxLayout* hLayout1 = new QHBoxLayout(calwidget);
|
||
|
|
|
||
|
|
QFont font2("微软雅黑", 26, QFont::Bold);
|
||
|
|
QFont font3("微软雅黑", 7, QFont::Bold);
|
||
|
|
|
||
|
|
//MIN
|
||
|
|
QLabel* minLabel = new QLabel("MIN(");
|
||
|
|
minLabel->setFont(font2);
|
||
|
|
minLabel->setPalette(palette);
|
||
|
|
hLayout1->addWidget(minLabel);
|
||
|
|
|
||
|
|
//公式1
|
||
|
|
{
|
||
|
|
QVBoxLayout* vLayout1 = new QVBoxLayout();
|
||
|
|
|
||
|
|
QHBoxLayout* topLayout1 = new QHBoxLayout();
|
||
|
|
QLabel* uslLabel = new QLabel(QString::number(USL) + "(规格上限)");
|
||
|
|
uslLabel->setFont(font3);
|
||
|
|
uslLabel->setPalette(palette);
|
||
|
|
|
||
|
|
QLabel* avgLabel = new QLabel("-" + QString::number(USL) + u8"(均值)");
|
||
|
|
avgLabel->setFont(font3);
|
||
|
|
avgLabel->setPalette(palette);
|
||
|
|
|
||
|
|
topLayout1->addWidget(uslLabel);
|
||
|
|
topLayout1->addWidget(avgLabel);
|
||
|
|
|
||
|
|
QLabel* line = new QLabel("------------------");
|
||
|
|
line->setPalette(palette);
|
||
|
|
line->setFixedHeight(5);
|
||
|
|
|
||
|
|
QLabel* deviationLabel = new QLabel(u8"(标准差)");
|
||
|
|
deviationLabel->setFont(font3);
|
||
|
|
deviationLabel->setPalette(palette);
|
||
|
|
deviationLabel->setAlignment(Qt::AlignCenter);
|
||
|
|
|
||
|
|
vLayout1->addLayout(topLayout1);
|
||
|
|
vLayout1->addWidget(line);
|
||
|
|
vLayout1->addWidget(deviationLabel);
|
||
|
|
|
||
|
|
hLayout1->addLayout(vLayout1);
|
||
|
|
}
|
||
|
|
|
||
|
|
//逗号
|
||
|
|
{
|
||
|
|
QLabel* lLabel = new QLabel(",");
|
||
|
|
lLabel->setFont(font2);
|
||
|
|
lLabel->setPalette(palette);
|
||
|
|
hLayout1->addWidget(lLabel);
|
||
|
|
}
|
||
|
|
|
||
|
|
//公式2
|
||
|
|
{
|
||
|
|
QVBoxLayout* vLayout1 = new QVBoxLayout();
|
||
|
|
|
||
|
|
QHBoxLayout* topLayout1 = new QHBoxLayout();
|
||
|
|
QLabel* uslLabel = new QLabel(QString::number(USL) + "(均值)");
|
||
|
|
uslLabel->setFont(font3);
|
||
|
|
uslLabel->setPalette(palette);
|
||
|
|
|
||
|
|
QLabel* avgLabel = new QLabel("-" + QString::number(USL) + u8"(规格下限)");
|
||
|
|
avgLabel->setFont(font3);
|
||
|
|
avgLabel->setPalette(palette);
|
||
|
|
|
||
|
|
topLayout1->addWidget(uslLabel);
|
||
|
|
topLayout1->addWidget(avgLabel);
|
||
|
|
|
||
|
|
QLabel* line = new QLabel("------------------");
|
||
|
|
line->setPalette(palette);
|
||
|
|
line->setFixedHeight(5);
|
||
|
|
|
||
|
|
QLabel* deviationLabel = new QLabel(u8"(标准差)");
|
||
|
|
deviationLabel->setFont(font3);
|
||
|
|
deviationLabel->setPalette(palette);
|
||
|
|
deviationLabel->setAlignment(Qt::AlignCenter);
|
||
|
|
|
||
|
|
vLayout1->addLayout(topLayout1);
|
||
|
|
vLayout1->addWidget(line);
|
||
|
|
vLayout1->addWidget(deviationLabel);
|
||
|
|
|
||
|
|
hLayout1->addLayout(vLayout1);
|
||
|
|
}
|
||
|
|
//括号
|
||
|
|
{
|
||
|
|
QLabel* lLabel = new QLabel(")");
|
||
|
|
lLabel->setFont(font2);
|
||
|
|
lLabel->setPalette(palette);
|
||
|
|
hLayout1->addWidget(lLabel);
|
||
|
|
}
|
||
|
|
//QLabel* cpkLabel = new QLabel(layout, Name+"CPK");
|
||
|
|
layout->addWidget(calwidget);
|
||
|
|
}
|
||
|
|
};
|
||
|
|
class cpkCalculatePanel :public QWidget
|
||
|
|
{
|
||
|
|
public:
|
||
|
|
QVBoxLayout* layout;
|
||
|
|
|
||
|
|
QLabel* label;
|
||
|
|
QLabel* title;
|
||
|
|
perCpkWidget* window1;
|
||
|
|
perCpkWidget* window2;
|
||
|
|
cpkCalculatePanel()
|
||
|
|
{
|
||
|
|
this->setObjectName("cpkCalculatePanel");
|
||
|
|
this->setStyleSheet("QWidget#cpkCalculatePanel {"
|
||
|
|
" border: 2px solid white;"
|
||
|
|
" border-radius: 10px;"
|
||
|
|
"}");
|
||
|
|
layout = new QVBoxLayout(this);
|
||
|
|
|
||
|
|
title = new QLabel("CPK计算");
|
||
|
|
QFont font("微软雅黑", 16, QFont::Bold);
|
||
|
|
QPalette palette;
|
||
|
|
palette.setColor(QPalette::WindowText, Qt::white);
|
||
|
|
|
||
|
|
title->setFont(font);
|
||
|
|
title->setPalette(palette);
|
||
|
|
title->setAlignment(Qt::AlignCenter);
|
||
|
|
title->setObjectName("titleLabel");
|
||
|
|
title->setStyleSheet("QLabel#titleLabel {"
|
||
|
|
" border: 4px solid white;"
|
||
|
|
" border-radius: 12px;"
|
||
|
|
"}");
|
||
|
|
title->setFixedHeight(40);
|
||
|
|
layout->addWidget(title);
|
||
|
|
|
||
|
|
window1 = new perCpkWidget("cpk长度");
|
||
|
|
layout->addWidget(window1);
|
||
|
|
|
||
|
|
window2 = new perCpkWidget("cpk宽度");
|
||
|
|
layout->addWidget(window2);
|
||
|
|
}
|
||
|
|
~cpkCalculatePanel()
|
||
|
|
{
|
||
|
|
|
||
|
|
}
|
||
|
|
};
|