summary refs log tree commit diff
path: root/src/ui
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2018-05-11 16:00:14 +0300
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2018-05-11 16:00:14 +0300
commit18061f06002b349bdc0e5b439a84d54545b9c87e (patch)
treec58d47200c244c8005ac05e7f7f73c030943088d /src/ui
parentMake explicit that MatrixClient & Cache are unique pointers (diff)
downloadnheko-18061f06002b349bdc0e5b439a84d54545b9c87e.tar.xz
Use the correct avatar size for HiDPI displays
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/Avatar.cc10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/ui/Avatar.cc b/src/ui/Avatar.cc
index 81e6cbed..2f10db39 100644
--- a/src/ui/Avatar.cc
+++ b/src/ui/Avatar.cc
@@ -1,6 +1,7 @@
 #include <QPainter>
 
 #include "Avatar.h"
+#include "Utils.h"
 
 Avatar::Avatar(QWidget *parent)
   : QWidget(parent)
@@ -64,10 +65,8 @@ Avatar::setSize(int size)
 {
         size_ = size;
 
-        if (!image_.isNull()) {
-                pixmap_ = QPixmap::fromImage(
-                  image_.scaled(size_, size_, Qt::KeepAspectRatio, Qt::SmoothTransformation));
-        }
+        if (!image_.isNull())
+                pixmap_ = utils::scaleImageToPixmap(image_, size_);
 
         QFont _font(font());
         _font.setPointSizeF(size_ * (ui::FontSize) / 40);
@@ -89,8 +88,7 @@ Avatar::setImage(const QImage &image)
 {
         image_  = image;
         type_   = ui::AvatarType::Image;
-        pixmap_ = QPixmap::fromImage(
-          image_.scaled(size_, size_, Qt::KeepAspectRatio, Qt::SmoothTransformation));
+        pixmap_ = utils::scaleImageToPixmap(image_, size_);
         update();
 }