From 6b627b1c5b936183c859597ec059a0aaadd0e426 Mon Sep 17 00:00:00 2001 From: nerix Date: Sat, 7 Jun 2025 13:31:58 +0200 Subject: [PATCH] fix(button): use DPR for cached pixmap scale (#6255) --- CHANGELOG.md | 2 +- src/widgets/buttons/Button.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5eb1fbee..dfaefbd6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,7 +53,7 @@ - Dev: Simplified string literals to be a re-export of Qt functions. (#6175) - Dev: Fixed incorrect lua generation of static methods for typescript plugins. (#6190, #6223) - Dev: Merged top/bottom and left/right notebook layouts. (#6215) -- Dev: Refactored `Button` and friends. (#6102) +- Dev: Refactored `Button` and friends. (#6102, #6255) - Dev: `OnceFlag`'s internal flag is now atomic. (#6237) - Dev: Bumped clang-format requirement to 19. (#6236) diff --git a/src/widgets/buttons/Button.cpp b/src/widgets/buttons/Button.cpp index cc972e1b..dc4c87cf 100644 --- a/src/widgets/buttons/Button.cpp +++ b/src/widgets/buttons/Button.cpp @@ -306,9 +306,11 @@ void Button::paintButton(QPainter &painter) if (this->cachePixmap_) { - if (this->cachedPixmap_.size() != this->size()) + if (this->cachedPixmap_.size() / this->devicePixelRatio() != + this->size()) { - this->cachedPixmap_ = QPixmap(this->size()); + this->cachedPixmap_ = + QPixmap(this->size() * this->devicePixelRatio()); this->cachedPixmap_.setDevicePixelRatio(this->devicePixelRatio()); this->pixmapValid_ = false; }