45 lines
1.4 KiB
Diff
45 lines
1.4 KiB
Diff
From d80a8b3b5dc5ddf841474ce1fd3024483e6adb9b Mon Sep 17 00:00:00 2001
|
|
From: liuxinhao <liuxinhao@kylinsec.com.cn>
|
|
Date: Fri, 18 Nov 2022 13:45:49 +0800
|
|
Subject: [PATCH 2/6] fix(user icon): fix the failure to update the drawing in
|
|
time when setting the default avatar
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
- 修复用户头像设置默认头像时未及时更新绘制
|
|
---
|
|
lib/common-widgets/user-avatar.cpp | 4 +++-
|
|
1 file changed, 3 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/lib/common-widgets/user-avatar.cpp b/lib/common-widgets/user-avatar.cpp
|
|
index 9394818..7869569 100644
|
|
--- a/lib/common-widgets/user-avatar.cpp
|
|
+++ b/lib/common-widgets/user-avatar.cpp
|
|
@@ -18,6 +18,7 @@
|
|
#include <QFile>
|
|
#include <QPainter>
|
|
#include <QPainterPath>
|
|
+#include <QApplication>
|
|
|
|
#define DEFAULT_USER_AVATAR ":/common-widgets-images/user_180.png"
|
|
|
|
@@ -81,7 +82,7 @@ QPixmap UserAvatar::scalePixmapAdjustSize (const QPixmap &pixmap)
|
|
QPixmap temp = pixmap.scaled(radius * 2, radius * 2, Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation);
|
|
return temp;
|
|
}
|
|
-#include <QApplication>
|
|
+
|
|
void UserAvatar::setDefaultImage ()
|
|
{
|
|
if (!m_pixmap.load(DEFAULT_USER_AVATAR))
|
|
@@ -90,4 +91,5 @@ void UserAvatar::setDefaultImage ()
|
|
return;
|
|
}
|
|
m_scaledPixmap = scalePixmapAdjustSize(m_pixmap);
|
|
+ update();
|
|
}
|
|
--
|
|
2.33.0
|
|
|