2025-09-24 12:10:51 +08:00
|
|
|
#include "alarmEventRealTimeDock.h"
|
|
|
|
|
#include "./ui_alarmEventRealTimeDock.h"
|
2025-10-17 18:15:06 +08:00
|
|
|
#include "alarmEventDataView.h"
|
2025-09-24 12:10:51 +08:00
|
|
|
|
|
|
|
|
#include <QPropertyAnimation>
|
|
|
|
|
#include <QTimer>
|
|
|
|
|
|
|
|
|
|
#define bottomMargin 0
|
|
|
|
|
AlarmEventRealTimeDock::AlarmEventRealTimeDock(QWidget* parent)
|
|
|
|
|
: QWidget(parent)
|
|
|
|
|
, ui(new Ui::alarmEventRealTimeDock)
|
|
|
|
|
{
|
|
|
|
|
ui->setupUi(this);
|
|
|
|
|
setAttribute(Qt::WA_TranslucentBackground);
|
|
|
|
|
|
|
|
|
|
m_isInAnimation = false;
|
|
|
|
|
m_curState = "collapse";
|
|
|
|
|
|
2025-10-17 18:15:06 +08:00
|
|
|
m_tableView = new AlarmEventDataView(this);
|
2025-10-21 11:13:08 +08:00
|
|
|
m_tableView->setModelMode(RealTime);
|
2025-10-17 18:15:06 +08:00
|
|
|
ui->tableLayout->addWidget(m_tableView);
|
|
|
|
|
|
2025-09-24 12:10:51 +08:00
|
|
|
m_animation = new QPropertyAnimation(this, "geometry");
|
|
|
|
|
m_animation->setDuration(120);
|
|
|
|
|
connect(m_animation, &QPropertyAnimation::finished, this, [this]{m_isInAnimation = false;});
|
|
|
|
|
|
|
|
|
|
ui->btnClose->setVisible(false);
|
|
|
|
|
connect(ui->btnOpen, &QPushButton::clicked, this, &AlarmEventRealTimeDock::onBtnClicked_open);
|
|
|
|
|
connect(ui->btnClose, &QPushButton::clicked, this, &AlarmEventRealTimeDock::onBtnClicked_close);
|
|
|
|
|
connect(ui->btnConfirmAll, &QPushButton::clicked, this, &AlarmEventRealTimeDock::onBtnClicked_confirmAll);
|
|
|
|
|
connect(ui->btnCheckAll, &QPushButton::clicked, this, &AlarmEventRealTimeDock::onBtnClicked_checkAll);
|
|
|
|
|
|
|
|
|
|
/*if(parent)
|
|
|
|
|
{
|
|
|
|
|
int parentWidth = parent->width();
|
|
|
|
|
int parentHeight = parent->height();
|
|
|
|
|
int selfWidth = parentWidth * 0.8;
|
|
|
|
|
int x = (parentWidth - selfWidth) * 0.5;
|
|
|
|
|
int y = parentHeight - ui->tobBar->height();
|
|
|
|
|
setGeometry(x, y, selfWidth, height());
|
|
|
|
|
}*/
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AlarmEventRealTimeDock::~AlarmEventRealTimeDock()
|
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
void AlarmEventRealTimeDock::expand()
|
|
|
|
|
{
|
|
|
|
|
if(m_isInAnimation || m_curState == "expand" )
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
QWidget* parent = this->parentWidget();
|
|
|
|
|
if(parent)
|
|
|
|
|
{
|
|
|
|
|
QRect startRect(x(), y(), width(), height());
|
|
|
|
|
QRect endRect(x(), parent->height() - height() - bottomMargin, width(), height());
|
|
|
|
|
m_animation->setStartValue(startRect);
|
|
|
|
|
m_animation->setEndValue(endRect);
|
|
|
|
|
m_animation->start();
|
|
|
|
|
m_curState = "expand";
|
|
|
|
|
m_isInAnimation = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AlarmEventRealTimeDock::collapse()
|
|
|
|
|
{
|
|
|
|
|
if(m_isInAnimation || m_curState == "collapse" )
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
QWidget* parent = this->parentWidget();
|
|
|
|
|
if(parent)
|
|
|
|
|
{
|
|
|
|
|
QRect startRect(x(), y(), width(), height());
|
|
|
|
|
QRect endRect(x(), parent->height() - ui->tobBar->height(), width(), height());
|
|
|
|
|
m_animation->setStartValue(startRect);
|
|
|
|
|
m_animation->setEndValue(endRect);
|
|
|
|
|
m_animation->start();
|
|
|
|
|
m_curState = "collapse";
|
|
|
|
|
m_isInAnimation = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AlarmEventRealTimeDock::updateGeometry()
|
|
|
|
|
{
|
|
|
|
|
QWidget* parent = this->parentWidget();
|
|
|
|
|
if(parent)
|
|
|
|
|
{
|
|
|
|
|
int parentWidth = parent->width();
|
|
|
|
|
int parentHeight = parent->height();
|
|
|
|
|
int selfWidth = parentWidth * 0.8;
|
|
|
|
|
int x = (parentWidth - selfWidth) * 0.5;
|
|
|
|
|
int y = parentHeight - ui->tobBar->height();
|
|
|
|
|
if(m_curState == "expand")
|
|
|
|
|
y = parentHeight - this->height() - bottomMargin;
|
|
|
|
|
setGeometry(x, y, selfWidth, height());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AlarmEventRealTimeDock::onBtnClicked_open()
|
|
|
|
|
{
|
|
|
|
|
expand();
|
|
|
|
|
ui->btnOpen->setVisible(false);
|
|
|
|
|
ui->btnClose->setVisible(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AlarmEventRealTimeDock::onBtnClicked_close()
|
|
|
|
|
{
|
|
|
|
|
collapse();
|
|
|
|
|
ui->btnOpen->setVisible(true);
|
|
|
|
|
ui->btnClose->setVisible(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AlarmEventRealTimeDock::onBtnClicked_confirmAll()
|
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
void AlarmEventRealTimeDock::onBtnClicked_checkAll()
|
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|