UpLowLimp/ZBD_IIIDL_S_Project/Src/PopDialog/festotalparamdialog.cpp
2024-11-25 17:15:44 +08:00

92 lines
1.8 KiB
C++

#include "festotalparamdialog.h"
#include "ui_festotalparamdialog.h"
#include <QPainter>
FesTotalParamDialog::FesTotalParamDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::FesTotalParamDialog),
m_value(0)
{
ui->setupUi(this);
this->setWindowFlags(Qt::FramelessWindowHint); //设置无边框
setAttribute(Qt::WA_TranslucentBackground,true); //设置透明
}
FesTotalParamDialog::~FesTotalParamDialog()
{
delete ui;
}
void FesTotalParamDialog::setTitleAndUnit(QString title, QString unit)
{
ui->title_Label->setText(title);
ui->unit_Label->setText(unit);
}
int FesTotalParamDialog::getValue()
{
return m_value;
}
void FesTotalParamDialog::setValue(int value)
{
ui->slider->setValue(value);
m_value = value;
}
void FesTotalParamDialog::setRange(int min, int max)
{
ui->slider->setRange(min,max);
}
void FesTotalParamDialog::on_cancel_Btn_clicked()
{
this->close();
}
void FesTotalParamDialog::on_confirm_Btn_clicked()
{
m_value = ui->value_Label->text().toInt();
this->close();
}
void FesTotalParamDialog::on_minus_Btn_clicked()
{
int value = ui->slider->value();
--value;
ui->slider->setValue(value);
}
void FesTotalParamDialog::on_plus_Btn_clicked()
{
int value = ui->slider->value();
++value;
ui->slider->setValue(value);
}
void FesTotalParamDialog::on_slider_valueChanged(int value)
{
ui->value_Label->setText(QString::number(value));
}
void FesTotalParamDialog::paintEvent(QPaintEvent *event)
{
Q_UNUSED(event)
QPainter painter(this);
painter.fillRect(rect(),QColor(0,0,0,100));
}
void FesTotalParamDialog::changeEvent(QEvent* event)
{
switch (event->type())
{
case QEvent::LanguageChange:
ui->retranslateUi(this);
break;
default:
QWidget::changeEvent(event);
break;
}
}