diff options
author | Konstantinos Sideris <sideris.konstantin@gmail.com> | 2018-05-11 16:00:14 +0300 |
---|---|---|
committer | Konstantinos Sideris <sideris.konstantin@gmail.com> | 2018-05-11 16:00:14 +0300 |
commit | 18061f06002b349bdc0e5b439a84d54545b9c87e (patch) | |
tree | c58d47200c244c8005ac05e7f7f73c030943088d /src/ui | |
parent | Make explicit that MatrixClient & Cache are unique pointers (diff) | |
download | nheko-18061f06002b349bdc0e5b439a84d54545b9c87e.tar.xz |
Use the correct avatar size for HiDPI displays
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/Avatar.cc | 10 |
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(); } |