project/xyylMCWEACSystem/parametersettingswidget.cpp

284 lines
12 KiB
C++

#include "parametersettingswidget.h"
#include <QButtonGroup>
ParameterSettingsWidget::ParameterSettingsWidget(QWidget *parent )
{
QStringList perHeighFreqstrlist;
perHeighFreqstrlist<<"0.05Hz"<<"0.1Hz"<<"1Hz"<<"2Hz"<<"5Hz";
QGridLayout * grid = new QGridLayout;
QSize tempSize(30,30);
QSize tempBtn(180,64);
m_labSettingTxt.setFixedSize(tempBtn);
grid->addWidget(&m_labSettingTxt,0,0,Qt::AlignHCenter);
int row =1;
int col =0;
QHBoxLayout * hlay_HieghtFre = new QHBoxLayout;
QLabel * m_labImageHeighFre= new QLabel;
m_labImageHeighFre->setFixedSize(tempSize);
m_labImageHeighFre->setStyleSheet("border-image:url(:/image/icon_HighFreq.png);}");
QLabel * m_labTxtHeighFre= new QLabel;
m_labTxtHeighFre->setText("高频滤波");
hlay_HieghtFre->addStretch();
hlay_HieghtFre->addWidget(m_labImageHeighFre);
hlay_HieghtFre->addWidget(m_labTxtHeighFre);
hlay_HieghtFre->addStretch();
QWidget * wtemp = new QWidget;
wtemp->setLayout(hlay_HieghtFre);
wtemp->setFixedSize(tempBtn);
//grid->addLayout(hlay_HieghtFre,row++,col,Qt::AlignHCenter);
grid->addWidget(wtemp,row++,col,Qt::AlignHCenter);
QButtonGroup *pButtonGroup = new QButtonGroup;
// 设置互斥
pButtonGroup->setExclusive(true);
// connect(pButtonGroup, SIGNAL(buttonClicked(QAbstractButton*)), this, SLOT(onButtonClicked(QAbstractButton*)));
for (int i = 0 ;i < perHeighFreqstrlist.size();i++)
{
QPushButton * btn = new QPushButton;
btn->setText(perHeighFreqstrlist.at(i));
pButtonGroup->addButton(btn);
grid->addWidget(btn,row++,col);
btn->setObjectName(perHeighFreqstrlist.at(i));
btn->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
btn->setFixedSize(tempBtn);
btn->setCheckable(true);
}
//2
row =1;
col++;
QStringList perLowFreqstrlist;
perLowFreqstrlist<<"10Hz"<<"30Hz"<<"50Hz"<<"70Hz"<<"100Hz";
QHBoxLayout * hlay_LowertFre = new QHBoxLayout;
QLabel * m_labImagelowerFre= new QLabel;
m_labImagelowerFre->setStyleSheet("border-image:url(:/image/icon_LowerFreq.png);}");
m_labImagelowerFre->setFixedSize(tempSize);
QLabel * m_labTxtlowerFre= new QLabel;
m_labTxtlowerFre->setText("低频滤波");
hlay_LowertFre->addWidget(m_labImagelowerFre);
hlay_LowertFre->addWidget(m_labTxtlowerFre);
grid->addLayout(hlay_LowertFre,row++,col,Qt::AlignHCenter);
pButtonGroup = new QButtonGroup;
pButtonGroup->setExclusive(true);
// connect(pButtonGroup, SIGNAL(buttonClicked(QAbstractButton*)), this, SLOT(onButtonClicked(QAbstractButton*)));
for (int i = 0 ;i < perLowFreqstrlist.size();i++)
{
QPushButton * btn = new QPushButton;
btn->setText(perHeighFreqstrlist.at(i));
pButtonGroup->addButton(btn);
grid->addWidget(btn,row++,col);
btn->setObjectName(perLowFreqstrlist.at(i));
btn->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
btn->setFixedSize(tempBtn);
btn->setCheckable(true);
}
//3
row =1;
col++;
QStringList perTimeConsttrlist;
perTimeConsttrlist<<"0.03Hz"<<"0.1Hz"<<"0.3Hz";
QHBoxLayout * hlay_TimeConst = new QHBoxLayout;
QLabel * m_labImageTimeConst= new QLabel;
m_labImageTimeConst->setStyleSheet("border-image:url(:/image/icon_TimeConst.png);}");
m_labImageTimeConst->setFixedSize(tempSize);
QLabel * m_labTxtTimeConst= new QLabel;
m_labTxtTimeConst->setText("时间常数");
hlay_TimeConst->addWidget(m_labImageTimeConst);
hlay_TimeConst->addWidget(m_labTxtTimeConst);
grid->addLayout(hlay_TimeConst,row++,col,Qt::AlignHCenter);
pButtonGroup = new QButtonGroup;
pButtonGroup->setExclusive(true);
// connect(pButtonGroup, SIGNAL(buttonClicked(QAbstractButton*)), this, SLOT(onButtonClicked(QAbstractButton*)));
for (int i = 0 ;i < perTimeConsttrlist.size();i++)
{
QPushButton * btn = new QPushButton;
btn->setText(perHeighFreqstrlist.at(i));
pButtonGroup->addButton(btn);
grid->addWidget(btn,row++,col);
btn->setObjectName(perTimeConsttrlist.at(i));
btn->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
btn->setFixedSize(tempBtn);
btn->setCheckable(true);
}
//4
row =1;
col++;
QStringList PowerFreNotchstrlist;
PowerFreNotchstrlist<<"0.05Hz"<<"0.1Hz"<<"1Hz"<<"2Hz"<<"5Hz";
QHBoxLayout * hlay_PowerFreNotch = new QHBoxLayout;
QLabel * m_labImagePowerFreNotch= new QLabel;
m_labImagePowerFreNotch->setStyleSheet("border-image:url(:/image/icon_PowerFreNotch.png);}");
m_labImagePowerFreNotch->setFixedSize(tempSize);
QLabel * m_labTxtPowerFreNotch= new QLabel;
m_labTxtPowerFreNotch->setText("工作馅波");
hlay_PowerFreNotch->addWidget(m_labImagePowerFreNotch);
hlay_PowerFreNotch->addWidget(m_labTxtPowerFreNotch);
grid->addLayout(hlay_PowerFreNotch,row++,col,Qt::AlignHCenter);
pButtonGroup = new QButtonGroup;
pButtonGroup->setExclusive(true);
//connect(pButtonGroup, SIGNAL(buttonClicked(QAbstractButton*)), this, SLOT(onButtonClicked(QAbstractButton*)));
for (int i = 0 ;i < PowerFreNotchstrlist.size();i++)
{
QPushButton * btn = new QPushButton;
btn->setText(PowerFreNotchstrlist.at(i));
pButtonGroup->addButton(btn);
grid->addWidget(btn,row++,col);
btn->setObjectName(PowerFreNotchstrlist.at(i));
btn->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
btn->setFixedSize(tempBtn);
btn->setCheckable(true);
}
//5
row =1;
col++;
QStringList Amplitudestrlist;
Amplitudestrlist<<"1"<<"2"<<"4"<<"8"<<"16"<<"32"<<"64";
QHBoxLayout * hlay_Amplitude = new QHBoxLayout;
QLabel * m_labImageAmplitude= new QLabel;
m_labImageAmplitude->setStyleSheet("border-image:url(:/image/icon_Amplitude.png);}");
m_labImageAmplitude->setFixedSize(tempSize);
QLabel * m_labTxtAmplitude= new QLabel;
m_labTxtAmplitude->setText("波幅");
hlay_Amplitude->addWidget(m_labImageAmplitude);
hlay_Amplitude->addWidget(m_labTxtAmplitude);
grid->addLayout(hlay_Amplitude,row++,col,Qt::AlignHCenter);
pButtonGroup = new QButtonGroup;
pButtonGroup->setExclusive(true);
for (int i = 0 ;i < Amplitudestrlist.size();i++)
{
QPushButton * btn = new QPushButton;
btn->setText(Amplitudestrlist.at(i));
pButtonGroup->addButton(btn);
grid->addWidget(btn,row++,col);
btn->setObjectName(Amplitudestrlist.at(i));
btn->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
btn->setFixedSize(tempBtn);
btn->setCheckable(true);
}
//6
row =1;
col++;
QStringList Wavevelocitystrlist;
Wavevelocitystrlist<<"100"<<"500"<<"1000"<<"2500"<<"5000"<<"10000"<<"15000";
QHBoxLayout * hlay_Wavevelocity = new QHBoxLayout;
QLabel * m_labImageWavevelocity= new QLabel;
m_labImageWavevelocity->setStyleSheet("border-image:url(:/image/icon_Amplitude.png);}");
m_labImageWavevelocity->setFixedSize(tempSize);
QLabel * m_labTxtWavevelocity= new QLabel;
m_labTxtWavevelocity->setText("波速");
hlay_Wavevelocity->addWidget(m_labImageWavevelocity);
hlay_Wavevelocity->addWidget(m_labTxtWavevelocity);
grid->addLayout(hlay_Wavevelocity,row++,col,Qt::AlignHCenter);
pButtonGroup = new QButtonGroup;
pButtonGroup->setExclusive(true);
//connect(pButtonGroup, SIGNAL(buttonClicked(QAbstractButton*)), this, SLOT(onButtonClicked(QAbstractButton*)));
for (int i = 0 ;i < Wavevelocitystrlist.size();i++)
{
QPushButton * btn = new QPushButton;
btn->setText(Wavevelocitystrlist.at(i));
pButtonGroup->addButton(btn);
grid->addWidget(btn,row++,col);
btn->setObjectName(Wavevelocitystrlist.at(i));
btn->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
btn->setFixedSize(tempBtn);
btn->setCheckable(true);
}
m_labSettingTxt.setText("参数设置");
m_labSettingTxt.setStyleSheet("font-family: 思源黑体;font-size: 32px;font-weight: 500; color: #0D9DDB;");
//QAction
m_btnOK.setText("保存");
m_btncanCel.setText("取消");
QHBoxLayout * hlay3 = new QHBoxLayout;
hlay3->addStretch();
hlay3->addWidget(&m_btncanCel);
hlay3->addWidget(&m_btnOK);
hlay3->addStretch();
QWidget * w = new QWidget;
w->setObjectName("parasetting");
w->setStyleSheet("QWidget#parasetting{background-color:white;border-radius: 10px;}");
w->setLayout(grid);
QVBoxLayout * vlay = new QVBoxLayout;
vlay->addWidget(w);
vlay->addLayout(hlay3);
setLayout(vlay);
this->setStyleSheet("QLabel{font-family: 思源黑体;font-size: 28px;color: #054578;font-weight: 500;}QPushButton{background-color:white; border-radius:10px; color: #666666;font-family: Source Han Sans; font-size: 30px;font-weight: normal;}\
QPushButton:hover{background: #41B962; border-radius:10px;padding:7px 10px;color: #666666; font-family: Source Han Sans; font-size: 30px;font-weight: normal; }\
QPushButton:pressed{ background: #41B962; border-radius:10px; padding:7px 10px;color: #666666; font-family: Source Han Sans; font-size: 30px;font-weight: normal; }\
QPushButton:checked{background: #41B962;border-radius:10px;padding:7px 10px; color: #666666; font-family: Source Han Sans; font-size: 30px;font-weight: normal;}");
m_btnOK.setStyleSheet("QPushButton{\
background: white;\
border-radius:10px;padding:7px 10px;\
}\
QPushButton:hover{\
background: #0d9ddb;\
border-radius:10px;padding:7px 10px;\
}\
QPushButton:pressed{\
background: #0d9ddb;\
border-radius:10px;padding:7px 10px;\
}\
QPushButton:checked{\
background: #0d9ddb;\
border-radius:10px;padding:7px 10px;\
}");
m_btncanCel.setStyleSheet("QPushButton{\
background: white;\
border-radius:10px;padding:7px 10px;\
}\
QPushButton:hover{\
background: #0d9ddb;\
border-radius:10px;padding:7px 10px;\
}\
QPushButton:pressed{\
background: #0d9ddb;\
border-radius:10px;padding:7px 10px;\
}\
QPushButton:checked{\
background: #0d9ddb;\
border-radius:10px;padding:7px 10px;\
}");
}
ParameterSettingsWidget::~ParameterSettingsWidget()
{
}
void ParameterSettingsWidget::init()
{
}
void ParameterSettingsWidget::initLay()
{
}
bool ParameterSettingsWidget::initConnect()
{
}