Bug 414904 - [KShortcutsEditorDelegate] ">" arrows are blurry on HiDPI screen
Summary: [KShortcutsEditorDelegate] ">" arrows are blurry on HiDPI screen
Status: RESOLVED FIXED
Alias: None
Product: frameworks-kxmlgui
Classification: Unclassified
Component: general (show other bugs)
Version: 5.65.0
Platform: Other Linux
: NOR minor
Target Milestone: ---
Assignee: kdelibs bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-12-06 20:13 UTC by postix
Modified: 2022-03-27 02:03 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.93


Attachments
Screenshot of the issue. (7.05 KB, image/png)
2019-12-06 20:13 UTC, postix
Details

Note You need to log in before you can comment on or make changes to this bug.
Description postix 2019-12-06 20:13:39 UTC
Created attachment 124344 [details]
Screenshot of the issue.

SUMMARY

The " > " arrows are blurry on a HiDPI screen, while the rest is super sharp. This holds for all dialogs, where " > " is used.

Please see the screenshot.


SOFTWARE/OS VERSIONS
Operating System: Manjaro Linux 
KDE Plasma Version: 5.17.4
KDE Frameworks Version: 5.65.0
Qt Version: 5.13.2


ADDITIONAL INFORMATION
Scaling 1.5
Comment 1 postix 2019-12-06 20:43:07 UTC
I have cloned systemsettings, checked out v5.17.4 and compiled it locally on my Manjaro system. 

With that build, I cannot reproduce this issue and the one of the "blurry printers" (413977).

Any ideas, what's going on? Has it been fixed by a recent commit to 5.17.4, which is not yet a part of the Manjaro 5.17.4 packages?
Comment 2 Nate Graham 2019-12-06 21:01:40 UTC
No, I see the issue as well with git master.
Comment 3 Ahmad Samir 2021-06-13 18:17:01 UTC
I think this can be fixed by using:
    QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, true);
    QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling, true);

but I am not sure we should do that in the dialog code; I think it should be in the application where the dialog(s) is launched from.
Comment 4 Christoph Cullmann 2021-06-13 18:21:37 UTC
(In reply to Ahmad Samir from comment #3)
> I think this can be fixed by using:
>     QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, true);
>     QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling, true);
> 
> but I am not sure we should do that in the dialog code; I think it should be
> in the application where the dialog(s) is launched from.

No, such stuff must be done by the application, preferable "before" the application object is created.
Comment 5 Ahmad Samir 2021-06-13 18:35:46 UTC
That makes sense (and it benefits the whole app rather than just one dialog, that is if it works at all setting those attributes _after_ the application object has been created).

Thanks for the confirmation :)
Comment 6 Bug Janitor Service 2022-03-19 11:51:18 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kitemviews/-/merge_requests/10
Comment 7 Bug Janitor Service 2022-03-19 11:52:39 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kxmlgui/-/merge_requests/104
Comment 8 snx 2022-03-22 21:39:32 UTC
Git commit a82076a6c353509ca404157237f61c6a28b37d3e by snooxx 💤.
Committed on 16/03/2022 at 20:11.
Pushed by ahmadsamir into branch 'master'.

KShortcutsEditorDelegate: Fix HiDPI rendering of indicator arrows

Even with HiDPI rendering enabled in applications, the standard
"Configure Keyboard Shortcuts" dialog would still show pixelated
indicator arrows in the "Shortcut" and "Alternate" columns.

This is because the respective pixmap is only scaled up, but not
rendered appropriately sized from the beginning.

Setting the pixmap's `devicePixelRatio` and increasing its size fixes
the issue. `option.rect` is in device independent pixels, and therefore
should be kept as is.

Note: In order for the arrows to still get drawn in the right place,
additional fixes in `KExtendableItemDelegate` (i.e. the base class) are
necessary, see frameworks/kitemviews!10.

Test Plan:
  - Launch `QT_SCALE_FACTOR=1.7 ./bin/kxmlguiwindowtest`.
  - Open "Configure Keyboard Shortcuts" dialog.
  - Arrows in "Shortcut" column should not be pixelated anymore, for
    both their expanded and collapsed states.
  - Test with `-style Fusion` and other scaling factors, too.

M  +7    -2    src/kshortcutseditordelegate.cpp

https://invent.kde.org/frameworks/kxmlgui/commit/a82076a6c353509ca404157237f61c6a28b37d3e
Comment 9 snx 2022-03-26 09:51:11 UTC
Git commit 1c15548132621f0a543572338402ff302c621ae1 by snooxx 💤.
Committed on 17/03/2022 at 01:36.
Pushed by meven into branch 'master'.

KExtendableItemDelegate: Fix HiDPI positioning of indicator arrows

After fixing pixelated indicator arrows in `KShortcutsEditorDelegate`
(i.e. a subclass, see frameworks/kxmlgui!104) used in the
"Configure Keyboard Shortcuts" dialog, they were not drawn centered
anymore, e.g. slightly moved upwards. The same problem can be observed
in the download list of KGet.

This is because the increased size of the pixmap is not accounted for.

By transforming the pixmap size to device independent dimensions
again, as used in the positioning calculations, the arrows will finally
be shown correctly.

Note that running `KItemViews` in conjunction with a version of
`KXmlGUI` not including the fix will still work fine, since the
`devicePixelRatio` will only ever be set to `1` in that case.

Test Plan:
  - Launch `QT_SCALE_FACTOR=1.7 ./bin/kxmlguiwindowtest`
    (from KXmlGui, including the fix mentioned above).
  - Open "Configure Keyboard Shortcuts" dialog.
  - Arrows in "Shortcut" column positioned correctly, for both their
    expanded and collapsed states.
  - Test with `-style Fusion` and other scaling factors, too.
  - `QT_SCALE_FACTOR=1.7 kget`, start download, observe indicator arrow
    in download list.

M  +10   -8    src/kextendableitemdelegate.cpp

https://invent.kde.org/frameworks/kitemviews/commit/1c15548132621f0a543572338402ff302c621ae1