diff options
| author | Pan Zhang <[email protected]> | 2025-09-26 10:27:41 +0800 |
|---|---|---|
| committer | Pan Zhang <[email protected]> | 2025-09-28 12:12:03 +0800 |
| commit | 96019a8592788932443fe0d0efc8ea44af2cf948 (patch) | |
| tree | bca4a20ca7259156819cbb5a49cbf94ee38caf95 /src | |
| parent | bca5cb1585d859721297c46ec4ee543c06ad179b (diff) | |
informationpanelcontent: prevent repeated disabled effect on previews
When switching files quickly in the Information Panel, the preview pixmap could appear progressively brighter/whiter. This happened because markOutdatedPreview() was applying KIconEffect::toDisabled() multiple times on the same pixmap while a preview job was still pending.
This patch fixes the issue by:
- Tracking the URL that was last disabled, and only applying the disabled effect once per URL.
- Clearing the disabled state whenever a new preview job starts or when a new pixmap is shown.
With this change, the "disabled preview" effect is preserved (still useful for slow HDD or network filesystems), but the progressive white-out artifact no longer occurs when navigating rapidly.
BUG: 507844
Diffstat (limited to 'src')
| -rw-r--r-- | src/panels/information/informationpanelcontent.cpp | 16 | ||||
| -rw-r--r-- | src/panels/information/informationpanelcontent.h | 1 |
2 files changed, 15 insertions, 2 deletions
diff --git a/src/panels/information/informationpanelcontent.cpp b/src/panels/information/informationpanelcontent.cpp index db7117e5a..afca9a76c 100644 --- a/src/panels/information/informationpanelcontent.cpp +++ b/src/panels/information/informationpanelcontent.cpp @@ -172,6 +172,9 @@ void InformationPanelContent::refreshPixmapView() m_previewJob->kill(); } + // Reset disabled state when starting a new preview job + m_disabledPreviewUrl.clear(); + // try to get a preview pixmap from the item... // Mark the currently shown preview as outdated. This is done @@ -362,6 +365,7 @@ void InformationPanelContent::showIcon(const KFileItem &item) QPixmap pixmap = KIconUtils::addOverlays(icon, item.overlays()).pixmap(m_preview->size(), devicePixelRatioF()); pixmap.setDevicePixelRatio(devicePixelRatioF()); m_preview->setPixmap(pixmap); + m_disabledPreviewUrl.clear(); } void InformationPanelContent::showPreview(const KFileItem &item, const QPixmap &pixmap) @@ -434,9 +438,17 @@ void InformationPanelContent::markOutdatedPreview() // use it until the preview is done showIcon(m_item); } else { + // Only apply disabled effect once per URL to avoid repeated brightening + if (m_disabledPreviewUrl == m_item.url()) { + return; + } + m_disabledPreviewUrl = m_item.url(); + QPixmap disabledPixmap = m_preview->pixmap(); - KIconEffect::toDisabled(disabledPixmap); - m_preview->setPixmap(disabledPixmap); + if (!disabledPixmap.isNull()) { + KIconEffect::toDisabled(disabledPixmap); + m_preview->setPixmap(disabledPixmap); + } } } diff --git a/src/panels/information/informationpanelcontent.h b/src/panels/information/informationpanelcontent.h index 58adfb9c0..e305eddde 100644 --- a/src/panels/information/informationpanelcontent.h +++ b/src/panels/information/informationpanelcontent.h @@ -154,6 +154,7 @@ private: QDialogButtonBox *m_configureButtons; bool m_isVideo; + QUrl m_disabledPreviewUrl; }; #endif // INFORMATIONPANELCONTENT_H |
