[krusader] [Bug 462307] File icons are drawn at wrong position if desktop scaling is active
https://bugs.kde.org/show_bug.cgi?id=462307 Nikita Melnichenko changed: What|Removed |Added CC||nowjumpb...@gmail.com --- Comment #27 from Nikita Melnichenko --- *** Bug 482292 has been marked as a duplicate of this bug. *** -- You are receiving this mail because: You are watching all bug changes.
[krusader] [Bug 462307] File icons are drawn at wrong position if desktop scaling is active
https://bugs.kde.org/show_bug.cgi?id=462307 Nikita Melnichenko changed: What|Removed |Added Resolution|--- |FIXED Status|REOPENED|RESOLVED Latest Commit||https://invent.kde.org/util ||ities/krusader/-/commit/83d ||d925e4d9d83a4a69239ae108301 ||68d50b522e --- Comment #26 from Nikita Melnichenko --- Git commit 83dd925e4d9d83a4a69239ae10830168d50b522e by Nikita Melnichenko. Committed on 10/11/2023 at 09:33. Pushed by melnichenko into branch 'stable'. Fixed file icon rendering in case application scaling is enabled FIXED: [ 462307 ] File icons are drawn at wrong position if desktop scaling is active Discussion: https://invent.kde.org/utilities/krusader/-/merge_requests/118 (cherry picked from commit e5a71586952049ac92fab6f05ed1ab05c1e733c4) M +0-1app/Panel/PanelView/krinterbriefview.cpp M +1-1app/Panel/PanelView/listmodel.cpp https://invent.kde.org/utilities/krusader/-/commit/83dd925e4d9d83a4a69239ae10830168d50b522e -- You are receiving this mail because: You are watching all bug changes.
[krusader] [Bug 462307] File icons are drawn at wrong position if desktop scaling is active
https://bugs.kde.org/show_bug.cgi?id=462307 Michal Hlavac changed: What|Removed |Added CC||m...@hlavki.eu -- You are receiving this mail because: You are watching all bug changes.
[krusader] [Bug 462307] File icons are drawn at wrong position if desktop scaling is active
https://bugs.kde.org/show_bug.cgi?id=462307 Oliver Klee changed: What|Removed |Added CC||kde...@oliverklee.de -- You are receiving this mail because: You are watching all bug changes.
[krusader] [Bug 462307] File icons are drawn at wrong position if desktop scaling is active
https://bugs.kde.org/show_bug.cgi?id=462307 bug2...@fantasymail.de changed: What|Removed |Added CC||bug2...@fantasymail.de -- You are receiving this mail because: You are watching all bug changes.
[krusader] [Bug 462307] File icons are drawn at wrong position if desktop scaling is active
https://bugs.kde.org/show_bug.cgi?id=462307 Toni Asensi Esteve changed: What|Removed |Added Resolution|LATER |--- Status|VERIFIED|REOPENED -- You are receiving this mail because: You are watching all bug changes.
[krusader] [Bug 462307] File icons are drawn at wrong position if desktop scaling is active
https://bugs.kde.org/show_bug.cgi?id=462307 Toni Asensi Esteve changed: What|Removed |Added Resolution|FIXED |LATER Status|RESOLVED|VERIFIED CC||toni.ase...@kdemail.net -- You are receiving this mail because: You are watching all bug changes.
[krusader] [Bug 462307] File icons are drawn at wrong position if desktop scaling is active
https://bugs.kde.org/show_bug.cgi?id=462307 Marius Cirsta changed: What|Removed |Added CC||marius_...@yahoo.com --- Comment #25 from Marius Cirsta --- I also ran into this issue after upgrading to Kubuntu 23.04. It is quite annoying because it looks strange but it's only fixable if not using scaling. Not sure if using Wayland is also a cause. -- You are receiving this mail because: You are watching all bug changes.
[krusader] [Bug 462307] File icons are drawn at wrong position if desktop scaling is active
https://bugs.kde.org/show_bug.cgi?id=462307 --- Comment #24 from Evgeny Brazgin --- I tried to look into the problem about colorful 16 and 22, mentioned above, and I think I came a little bit closer to actual reason of the current bug. The reason is that when you request icon of size 16, its requested size is converted by Qt to icon of size 32 before reaching `IconEngine` (Krusader's icon.cpp), and it loads icon of size 32 from the system theme, disregarding already applied scale ratio. And icon of size 32 is already colorful. And in the end looks like icons are double-scaled (which caused the original issue of this bug, all loaded icons are 4x size of requested icon size, even though my screen is 2x density). At first, `KrView::getIcon` calls `QIcon::pixmap(size)`, which internally multiplies size by 2 because of `Qt::AA_UseHighDpiPixmaps` flag and returns double-sized icon size, see Qt source details here: https://github.com/qt/qtbase/blob/5.15/src/gui/image/qicon.cpp#L911 Then, Krusader's `IconEngine::pixmap` (icon.cpp), which is part of `Icon` implementation (and is called within `QIcon::pixmap`), and which gets that double size as input argument, calls `QIcon::pixmap(size)` again on a found theme icon. It doubles icon size again for the same reason, and quadruple-sized icon is loaded. I found that overriding `IconEngine::scaledPixmap` (via `QIconEngine::virtualHook`) and bringing back the size to original (because we can't avoid scaling under `Qt::AA_UseHighDpiPixmaps`) helps to fix the issue, and correctly colored icons are returned. Moreover, it partially makes workaround from https://invent.kde.org/utilities/krusader/-/merge_requests/118 unnecessary (partially, because even though icon sizes are correct, icon positions are still wrong, so it is not final solution). Looks like Qt6 has some better apis for setting explicit devicePixelRatio, and it would help to make less hacky approach (https://doc.qt.io/qt-6/qicon.html#pixmap-3). Without that, need a hack to override `scaledPixmap` and bring size down. I'll try to clean up my code soon, test it a little bit and make another PR. It will incrementally improve state of things (e.g. fix colored icons usage), and partially fix root cause of current bug, but not completely fix it. (Note: all multipliers in my comment above are 2, because my screen density reports 2 in Qt. For some other configurations, numbers can be different, so don't consider that value as universally used) -- You are receiving this mail because: You are watching all bug changes.
[krusader] [Bug 462307] File icons are drawn at wrong position if desktop scaling is active
https://bugs.kde.org/show_bug.cgi?id=462307 --- Comment #23 from Felis --- With the latest krusader (gitrev: d03aed26) 16 and 22 sized icons in the view panes use colorful versions designed for big sizes, which is a regression from pre 2.8 (and a deviation from unscaled) behavior where icons up to 22 use simplified mostly monochrome versions designed for small sizes. -- You are receiving this mail because: You are watching all bug changes.
[krusader] [Bug 462307] File icons are drawn at wrong position if desktop scaling is active
https://bugs.kde.org/show_bug.cgi?id=462307 Bug Janitor Service changed: What|Removed |Added Priority|NOR |HI -- You are receiving this mail because: You are watching all bug changes.
[krusader] [Bug 462307] File icons are drawn at wrong position if desktop scaling is active
https://bugs.kde.org/show_bug.cgi?id=462307 Nikita Melnichenko changed: What|Removed |Added CC||k...@bh.m5k8.net --- Comment #22 from Nikita Melnichenko --- *** Bug 466465 has been marked as a duplicate of this bug. *** -- You are receiving this mail because: You are watching all bug changes.
[krusader] [Bug 462307] File icons are drawn at wrong position if desktop scaling is active
https://bugs.kde.org/show_bug.cgi?id=462307 Nikita Melnichenko changed: What|Removed |Added CC||onni.kukkone...@gmail.com --- Comment #21 from Nikita Melnichenko --- *** Bug 467987 has been marked as a duplicate of this bug. *** -- You are receiving this mail because: You are watching all bug changes.
[krusader] [Bug 462307] File icons are drawn at wrong position if desktop scaling is active
https://bugs.kde.org/show_bug.cgi?id=462307 Nikita Melnichenko changed: What|Removed |Added Resolution|--- |FIXED Status|CONFIRMED |RESOLVED --- Comment #20 from Nikita Melnichenko --- Merged: https://invent.kde.org/utilities/krusader/-/commit/e5a71586952049ac92fab6f05ed1ab05c1e733c4 Somehow Bugzilla tag didn't trigger, closing manually. -- You are receiving this mail because: You are watching all bug changes.
[krusader] [Bug 462307] File icons are drawn at wrong position if desktop scaling is active
https://bugs.kde.org/show_bug.cgi?id=462307 Carbug changed: What|Removed |Added CC||b...@caralluin.de -- You are receiving this mail because: You are watching all bug changes.
[krusader] [Bug 462307] File icons are drawn at wrong position if desktop scaling is active
https://bugs.kde.org/show_bug.cgi?id=462307 --- Comment #19 from Dmitry Yasenovsky --- Thank you very much for fixing this bug that has been bugging me for a long time! I have been using Krusader (2.9.0-dev) for several days with following 2 fixes: https://bugs.kde.org/show_bug.cgi?id=462307#c17 https://invent.kde.org/utilities/krusader/-/merge_requests/118/diffs?diff_id=613721_sha=2bd5cd0db362db944bdea639bf0be33f6f439268 No any problem. Debian 11 QT_SCREEN_SCALE_FACTORS=DisplayPort-0=2;DisplayPort-1=2;DisplayPort-2=2;DisplayPort-3=2;HDMI-A-0=2;H DMI-A-1=2; -- You are receiving this mail because: You are watching all bug changes.
[krusader] [Bug 462307] File icons are drawn at wrong position if desktop scaling is active
https://bugs.kde.org/show_bug.cgi?id=462307 --- Comment #18 from Evgeny Brazgin --- PR: https://invent.kde.org/utilities/krusader/-/merge_requests/118 -- You are receiving this mail because: You are watching all bug changes.
[krusader] [Bug 462307] File icons are drawn at wrong position if desktop scaling is active
https://bugs.kde.org/show_bug.cgi?id=462307 Evgeny Brazgin changed: What|Removed |Added CC||k...@xapienz.ru --- Comment #17 from Evgeny Brazgin --- Thanks Benjamin for finding the cause! I found a shorter workaround — just wrap a pixmap into QIcon. diff --git a/app/Panel/PanelView/listmodel.cpp b/app/Panel/PanelView/listmodel.cpp index d6ad6c5f..7731e895 100644 --- a/app/Panel/PanelView/listmodel.cpp +++ b/app/Panel/PanelView/listmodel.cpp @@ -177,7 +177,7 @@ QVariant ListModel::data(const QModelIndex& index, int role) const if (properties()->displayIcons) { if (_justForSizeHint) return QPixmap(_view->fileIconSize(), _view->fileIconSize()); -return _view->getIcon(fileitem); +return QIcon(_view->getIcon(fileitem)); } break; } It might be more efficient to change all the inner calls of it to directly return QIcon (because this is what the things inside operate with), however that would be a lot more complicated solution. -- You are receiving this mail because: You are watching all bug changes.
[krusader] [Bug 462307] File icons are drawn at wrong position if desktop scaling is active
https://bugs.kde.org/show_bug.cgi?id=462307 --- Comment #16 from Dmitry Yasenovsky --- Yes, Benjamin, it works. But blurry pictures look very bad. I think the program should use icons of size 16, 22, 32, 48 without resizing. I've been seeing the problem with icons for 2 years now. 'Toolbar settings' do not function properly for the third year. Is the Krusader still alive? -- You are receiving this mail because: You are watching all bug changes.
[krusader] [Bug 462307] File icons are drawn at wrong position if desktop scaling is active
https://bugs.kde.org/show_bug.cgi?id=462307 --- Comment #15 from Benjamin Buch --- The actual bug seems to be in `QItemDelegate::paint`. There a `decorationRect` is calculated which apparently ignores the `devicePixelRatio` property. The following workaround draws the icon in the right size and at the right place. However, they become blurred. diff --git a/app/Panel/PanelView/listmodel.cpp b/app/Panel/PanelView/listmodel.cpp index d6ad6c5f..209fcfb8 100644 --- a/app/Panel/PanelView/listmodel.cpp +++ b/app/Panel/PanelView/listmodel.cpp @@ -177,7 +177,18 @@ QVariant ListModel::data(const QModelIndex& index, int role) const if (properties()->displayIcons) { if (_justForSizeHint) return QPixmap(_view->fileIconSize(), _view->fileIconSize()); -return _view->getIcon(fileitem); +auto pixmap = _view->getIcon(fileitem); + +// BUG 462307 Workaround BEGIN +// KrViewItemDelegate::paint does the paint by QItemDelegate::paint +// which seams to have a bug that ignores the devicePixelRatio +// in calculating the decorationRect +pixmap = pixmap.scaled(pixmap.size() / pixmap.devicePixelRatio(), +Qt::IgnoreAspectRatio, Qt::SmoothTransformation); +pixmap.setDevicePixelRatio(1); +// BUG 462307 Workaround END + +return pixmap; } break; } -- You are receiving this mail because: You are watching all bug changes.
[krusader] [Bug 462307] File icons are drawn at wrong position if desktop scaling is active
https://bugs.kde.org/show_bug.cgi?id=462307 Benjamin Buch changed: What|Removed |Added CC||vit...@easycoding.org --- Comment #14 from Benjamin Buch --- *** Bug 464282 has been marked as a duplicate of this bug. *** -- You are receiving this mail because: You are watching all bug changes.
[krusader] [Bug 462307] File icons are drawn at wrong position if desktop scaling is active
https://bugs.kde.org/show_bug.cgi?id=462307 Benjamin Buch changed: What|Removed |Added CC||benni.b...@gmail.com Summary|No folder or file icons are |File icons are drawn at |shown |wrong position if desktop ||scaling is active -- You are receiving this mail because: You are watching all bug changes.