feat:实时告警列表实现无数据时展示空表格样式

This commit is contained in:
duanshengchao 2025-10-28 18:50:59 +08:00
parent 9d82145e6d
commit 68a9956bcb
3 changed files with 34 additions and 14 deletions

View File

@ -33,7 +33,8 @@ private:
Ui::alarmEventRealTimeDock* ui;
AlarmEventDataView* m_tableView;
QPropertyAnimation* m_animation;
QPropertyAnimation* m_animationExpand;
QPropertyAnimation* m_animationAlert;
bool m_isInAnimation;
QString m_curState;
};

View File

@ -19,9 +19,9 @@ AlarmEventRealTimeDock::AlarmEventRealTimeDock(QWidget* parent)
m_tableView = new AlarmEventDataView(RealTime, this);
ui->tableLayout->addWidget(m_tableView);
m_animation = new QPropertyAnimation(this, "geometry");
m_animation->setDuration(120);
connect(m_animation, &QPropertyAnimation::finished, this, [this]{m_isInAnimation = false;});
m_animationExpand = new QPropertyAnimation(this, "geometry");
m_animationExpand->setDuration(120);
connect(m_animationExpand, &QPropertyAnimation::finished, this, [this]{m_isInAnimation = false;});
ui->btnClose->setVisible(false);
connect(ui->btnOpen, &QPushButton::clicked, this, &AlarmEventRealTimeDock::onBtnClicked_open);
@ -53,9 +53,9 @@ void AlarmEventRealTimeDock::expand()
{
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_animationExpand->setStartValue(startRect);
m_animationExpand->setEndValue(endRect);
m_animationExpand->start();
m_curState = "expand";
m_isInAnimation = true;
}
@ -70,10 +70,10 @@ void AlarmEventRealTimeDock::collapse()
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();
QRect endRect(x(), parent->height() - ui->tobBar->height() - ui->alertWidget->height(), width(), height());
m_animationExpand->setStartValue(startRect);
m_animationExpand->setEndValue(endRect);
m_animationExpand->start();
m_curState = "collapse";
m_isInAnimation = true;
}
@ -88,7 +88,7 @@ void AlarmEventRealTimeDock::updateGeometry()
int parentHeight = parent->height();
int selfWidth = parentWidth * 0.8;
int x = (parentWidth - selfWidth) * 0.5;
int y = parentHeight - ui->tobBar->height();
int y = parentHeight - ui->tobBar->height() - ui->alertWidget->height();
if(m_curState == "expand")
y = parentHeight - this->height() - bottomMargin;
setGeometry(x, y, selfWidth, height());

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>1177</width>
<height>250</height>
<height>265</height>
</rect>
</property>
<property name="windowTitle">
@ -22,7 +22,7 @@ color: rgb(200, 200, 200);
</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<layout class="QVBoxLayout" name="mainLayout">
<property name="spacing">
<number>0</number>
</property>
@ -38,6 +38,25 @@ color: rgb(200, 200, 200);
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QWidget" name="alertWidget" native="true">
<property name="minimumSize">
<size>
<width>0</width>
<height>15</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>15</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background-color: qradialgradient(spread:pad, cx:0.5, cy:0.6, radius:0.5, fx:0.5, fy:0.5, stop:0 rgba(200, 0, 0, 0), stop:1 rgba(255, 255, 255, 0));</string>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="contentWidget" native="true">
<property name="styleSheet">