mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-12-14 21:02:04 +08:00
fix: 修复 Deepin 系统上显示“开发者模式未开启”的问题
没有区分 Deepin 和 UOS,在 Deepin 上对开发者模式状态文件进行判断,可能造成错误 Log: 添加判断区分 Deepin 和 UOS,仅在 UOS 判断开发者模式状态文件;优化 main 函数长度,将环境变量设置和 config.ini 读写放入 Utils 独立静态函数中调用;修复从托盘打开主界面时透明度动画不流畅的问题;优化关闭窗口动画代码,与打开窗口动画代码合并;修复主窗口关闭时,从托盘打开关于对话框后,调起主窗口会遮挡关于对话框的问题
This commit is contained in:
@@ -1,8 +1,5 @@
|
||||
#include "widgetanimation.h"
|
||||
|
||||
WidgetAnimation::WidgetAnimation()
|
||||
{
|
||||
}
|
||||
#include "widgets/base/basewidgetopacity.h"
|
||||
|
||||
void WidgetAnimation::widgetShake(QWidget *pWidget, int nRange)
|
||||
{
|
||||
@@ -28,27 +25,35 @@ void WidgetAnimation::widgetShake(QWidget *pWidget, int nRange)
|
||||
QPropertyAnimation *WidgetAnimation::createWidgetOpacity(QWidget *pWidget, bool isAppear)
|
||||
{
|
||||
QPropertyAnimation *animation = new QPropertyAnimation(pWidget, "windowOpacity", pWidget);
|
||||
// 设置动画效果
|
||||
animation->setEasingCurve(QEasingCurve::Linear);
|
||||
// 设置动画时间(单位:毫秒)
|
||||
animation->setDuration(500);
|
||||
// 设置动画步长值,以及在该位置时显示的透明度
|
||||
if (isAppear)
|
||||
{
|
||||
animation->setKeyValueAt(0, 0);
|
||||
// m_animation->setKeyValueAt(0.5, 0);
|
||||
animation->setKeyValueAt(1, 1);
|
||||
// 设置动画效果
|
||||
animation->setEasingCurve(QEasingCurve::Linear);
|
||||
// 设置动画步长值,以及在该位置时显示的透明度(即动画关键帧)
|
||||
animation->setKeyValueAt(0.0, 0.0);
|
||||
animation->setKeyValueAt(1.0, 1.0);
|
||||
}
|
||||
else
|
||||
{
|
||||
animation->setKeyValueAt(0, 1);
|
||||
animation->setKeyValueAt(1, 0);
|
||||
animation->setEasingCurve(QEasingCurve::OutQuart);
|
||||
animation->setKeyValueAt(0.0, 1.0);
|
||||
animation->setKeyValueAt(1.0, 0.0);
|
||||
|
||||
QObject::connect(animation, &QPropertyAnimation::finished, pWidget, [=]() { pWidget->close(); });
|
||||
}
|
||||
|
||||
QObject::connect(animation, &QPropertyAnimation::valueChanged, pWidget, [=]()
|
||||
{
|
||||
pWidget->update(); // NOTE: 保证窗口透明度动画平滑
|
||||
});
|
||||
|
||||
return animation;
|
||||
}
|
||||
|
||||
void WidgetAnimation::widgetOpacity(QWidget *pWidget, bool isAppear)
|
||||
{
|
||||
// 开始动画
|
||||
createWidgetOpacity(pWidget, isAppear)->start();
|
||||
// 启动/关闭动画
|
||||
createWidgetOpacity(pWidget, isAppear)->start(QPropertyAnimation::DeleteWhenStopped);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user