From 90db7a3995d7fa77fd5190bb32fc1f647d532f81 Mon Sep 17 00:00:00 2001 From: fourtf Date: Mon, 18 Dec 2017 01:17:02 +0100 Subject: [PATCH] fixed user popup not hidpi scaling properly --- src/widgets/accountpopup.cpp | 12 ++++++++++++ src/widgets/accountpopup.hpp | 3 +++ 2 files changed, 15 insertions(+) diff --git a/src/widgets/accountpopup.cpp b/src/widgets/accountpopup.cpp index 3cbfdbf21..9d1a566aa 100644 --- a/src/widgets/accountpopup.cpp +++ b/src/widgets/accountpopup.cpp @@ -25,6 +25,8 @@ AccountPopupWidget::AccountPopupWidget(std::shared_ptr channel) { _ui->setupUi(this); + this->layout()->setSizeConstraint(QLayout::SetFixedSize); + setWindowFlags(Qt::FramelessWindowHint); this->initAsWindow(); @@ -120,6 +122,8 @@ AccountPopupWidget::AccountPopupWidget(std::shared_ptr channel) util::twitch::getUserID(userNickname, this, [=](const QString &id) { currentTwitchUser->setUserId(id); }); + + this->dpiMultiplyerChanged(this->getDpiMultiplier(), this->getDpiMultiplier()); } void AccountPopupWidget::setName(const QString &name) @@ -196,6 +200,14 @@ void AccountPopupWidget::updatePermissions() } } +void AccountPopupWidget::dpiMultiplyerChanged(float oldDpi, float newDpi) +{ + this->setStyleSheet(QString("* { font-size: px; }") + .replace("", QString::number((int)(12 * newDpi)))); + + this->_ui->lblAvatar->setFixedSize((int)(100 * newDpi), (int)(100 * newDpi)); +} + void AccountPopupWidget::updateButtons(QWidget *layout, bool state) { for (auto button : layout->findChildren()) { diff --git a/src/widgets/accountpopup.hpp b/src/widgets/accountpopup.hpp index 7097736c4..d36e6c047 100644 --- a/src/widgets/accountpopup.hpp +++ b/src/widgets/accountpopup.hpp @@ -30,6 +30,9 @@ public: void updatePermissions(); +protected: + virtual void dpiMultiplyerChanged(float oldDpi, float newDpi) override; + private: Ui::AccountPopup *_ui;