From 73b9fbe70b54c9299ca350229aa616bde548aaa0 Mon Sep 17 00:00:00 2001 From: Jyrki Gadinger Date: Thu, 25 Sep 2025 12:25:15 +0200 Subject: [PATCH 1/2] fix(folderstatusdelegate): improve rendering of icons on HiDPI screens Signed-off-by: Jyrki Gadinger --- src/gui/folderstatusdelegate.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/gui/folderstatusdelegate.cpp b/src/gui/folderstatusdelegate.cpp index a31c9ef9aa..30f812bcba 100644 --- a/src/gui/folderstatusdelegate.cpp +++ b/src/gui/folderstatusdelegate.cpp @@ -190,12 +190,14 @@ void FolderStatusDelegate::paint(QPainter *painter, const QStyleOptionViewItem & localPathRect.setLeft(nextToIcon); remotePathRect.setLeft(nextToIcon); - const auto iconSize = iconRect.width(); - auto optionsButtonVisualRect = optionsButtonRect(option.rect, option.direction); - const auto statusPixmap = statusIcon.pixmap(iconSize, iconSize, syncEnabled ? QIcon::Normal : QIcon::Disabled); - painter->drawPixmap(QStyle::visualRect(option.direction, option.rect, iconRect).left(), iconRect.top(), statusPixmap); + statusIcon.paint( + painter, + QStyle::visualRect(option.direction, option.rect, iconRect), + Qt::AlignCenter, + syncEnabled ? QIcon::Normal : QIcon::Disabled + ); // only show the warning icon if the sync is running. Otherwise its // encoded in the status icon. From 158db5fd677b711e980b4bfb24734e3ecdca0b27 Mon Sep 17 00:00:00 2001 From: Jyrki Gadinger Date: Thu, 25 Sep 2025 12:40:20 +0200 Subject: [PATCH 2/2] chore(folderstatusdelegate): remove broken warning icon overlay also get rid of some roles that were unused Signed-off-by: Jyrki Gadinger --- src/gui/folderstatusdelegate.cpp | 17 ----------------- src/gui/folderstatusdelegate.h | 3 --- src/gui/folderstatusmodel.cpp | 9 +-------- 3 files changed, 1 insertion(+), 28 deletions(-) diff --git a/src/gui/folderstatusdelegate.cpp b/src/gui/folderstatusdelegate.cpp index 30f812bcba..b8453dc5cb 100644 --- a/src/gui/folderstatusdelegate.cpp +++ b/src/gui/folderstatusdelegate.cpp @@ -156,8 +156,6 @@ void FolderStatusDelegate::paint(QPainter *painter, const QStyleOptionViewItem & auto overallPercent = qvariant_cast(index.data(SyncProgressOverallPercent)); auto overallString = qvariant_cast(index.data(SyncProgressOverallString)); auto itemString = qvariant_cast(index.data(SyncProgressItemString)); - auto warningCount = qvariant_cast(index.data(WarningCount)); - auto syncOngoing = qvariant_cast(index.data(SyncRunning)); auto syncEnabled = qvariant_cast(index.data(FolderAccountConnected)); auto syncText = qvariant_cast(index.data(FolderSyncText)); @@ -199,21 +197,6 @@ void FolderStatusDelegate::paint(QPainter *painter, const QStyleOptionViewItem & syncEnabled ? QIcon::Normal : QIcon::Disabled ); - // only show the warning icon if the sync is running. Otherwise its - // encoded in the status icon. - if (warningCount > 0 && syncOngoing) { - QRect warnRect; - warnRect.setLeft(iconRect.left()); - warnRect.setTop(iconRect.bottom() - 17); - warnRect.setWidth(16); - warnRect.setHeight(16); - - QIcon warnIcon(":/client/theme/warning"); - const auto warnPixmap = warnIcon.pixmap(16, 16, syncEnabled ? QIcon::Normal : QIcon::Disabled); - warnRect = QStyle::visualRect(option.direction, option.rect, warnRect); - painter->drawPixmap(QPoint(warnRect.left(), warnRect.top()), warnPixmap); - } - auto palette = option.palette; auto colourGroup = option.state & QStyle::State_Enabled ? QPalette::Normal : QPalette::Disabled; diff --git a/src/gui/folderstatusdelegate.h b/src/gui/folderstatusdelegate.h index cfdf82bc83..4bb2bfe0c0 100644 --- a/src/gui/folderstatusdelegate.h +++ b/src/gui/folderstatusdelegate.h @@ -33,9 +33,6 @@ public: SyncProgressOverallPercent, SyncProgressOverallString, SyncProgressItemString, - WarningCount, - SyncRunning, - SyncDate, AddButton, // 1 = enabled; 2 = disabled FolderSyncText, diff --git a/src/gui/folderstatusmodel.cpp b/src/gui/folderstatusmodel.cpp index 6904bffc60..352e1d56fe 100644 --- a/src/gui/folderstatusmodel.cpp +++ b/src/gui/folderstatusmodel.cpp @@ -254,10 +254,6 @@ QVariant FolderStatusModel::data(const QModelIndex &index, int role) const return folder->virtualFilesEnabled() && folder->vfs().mode() != Vfs::Mode::WindowsCfApi ? QStringList(tr("Virtual file support is enabled.")) : QStringList(); - case FolderStatusDelegate::SyncRunning: - return folder->syncResult().status() == SyncResult::SyncRunning; - case FolderStatusDelegate::SyncDate: - return folder->syncResult().syncTime(); case FolderStatusDelegate::HeaderRole: return folder->shortGuiRemotePathOrAppName(); case FolderStatusDelegate::FolderAliasRole: @@ -306,8 +302,6 @@ QVariant FolderStatusModel::data(const QModelIndex &index, int role) const case FolderStatusDelegate::SyncProgressItemString: // e.g. Syncing fileName1, filename2 return progress._progressString; - case FolderStatusDelegate::WarningCount: - return progress._warningCount; case FolderStatusDelegate::SyncProgressOverallPercent: return progress._overallPercent; case FolderStatusDelegate::SyncProgressOverallString: @@ -985,8 +979,7 @@ void FolderStatusModel::slotSetProgress(const ProgressInfo &progress) _isSyncRunningForAwhile = false; } - const QVector roles{ FolderStatusDelegate::SyncProgressItemString, FolderStatusDelegate::WarningCount, - Qt::ToolTipRole }; + const QVector roles{ FolderStatusDelegate::SyncProgressItemString, Qt::ToolTipRole }; if (progress.status() == ProgressInfo::Discovery) { if (!progress._currentDiscoveredRemoteFolder.isEmpty()) {