Address code review feedback: remove const_cast and document scaling formula

Co-authored-by: jonaski <10343810+jonaski@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-12-28 00:09:12 +00:00
parent 350d907e8b
commit 0df4afe363
2 changed files with 6 additions and 4 deletions

View File

@@ -112,10 +112,10 @@ PlaylistSequence::~PlaylistSequence() {
delete ui_;
}
int PlaylistSequence::CalculateIconSize() const {
int PlaylistSequence::CalculateIconSize() {
// Get screen information for the widget
QScreen *screen = Utilities::GetScreen(const_cast<PlaylistSequence*>(this));
QScreen *screen = Utilities::GetScreen(this);
if (!screen) {
screen = QGuiApplication::primaryScreen();
}
@@ -141,7 +141,9 @@ int PlaylistSequence::CalculateIconSize() const {
const qreal dpi_factor = device_pixel_ratio / kReferenceDevicePixelRatio;
// Calculate final icon size with combined scaling
// Use a balanced approach: resolution contributes 50%, DPI contributes 50%
// Formula: 50% from resolution scaling + 50% from DPI scaling + 50% base multiplier
// The 0.5 base ensures icons scale up appropriately across different displays
// Without it, icons would be too small on average displays
const qreal combined_factor = (resolution_factor * 0.5) + (dpi_factor * 0.5) + 0.5;
int calculated_size = static_cast<int>(kBaseIconSize * combined_factor);

View File

@@ -83,7 +83,7 @@ class PlaylistSequence : public QWidget {
private:
void Load();
void Save();
int CalculateIconSize() const;
int CalculateIconSize();
static QIcon AddDesaturatedIcon(const QIcon &icon);
static QPixmap DesaturatedPixmap(const QPixmap &pixmap);