Bug 471151

Summary: Paths are not entirely readable in Locations KCM
Product: [Applications] systemsettings Reporter: Patrick Silva <bugseforuns>
Component: kcm_desktoppathAssignee: Plasma Bugs List <plasma-bugs-null>
Status: RESOLVED UPSTREAM    
Severity: normal CC: nate, qydwhotmail
Priority: NOR Keywords: junior-jobs, qt6
Version First Reported In: master   
Target Milestone: ---   
Platform: Neon   
OS: Linux   
Latest Commit: Version Fixed/Implemented In: 6.0
Sentry Crash Report:
Attachments: screenshot
screenshot2
font settings
fonts
screenshot2
location without accent

Description Patrick Silva 2023-06-17 13:01:33 UTC
STEPS TO REPRODUCE
1. open Locations KCM
2. observe the paths 
3. 

OBSERVED RESULT
the beginning of some paths is cut off

EXPECTED RESULT
all paths should be entirely readable

SOFTWARE/OS VERSIONS
Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.27.80
KDE Frameworks Version: 5.240.0
Qt Version: 6.5.1
Graphics Platform: Wayland
Comment 1 Patrick Silva 2023-06-17 13:29:37 UTC
Created attachment 159743 [details]
screenshot
Comment 2 Nate Graham 2023-06-21 04:21:55 UTC
I don't believe this is a Qt regression; it seems to be an issue caused by the QML port in https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/1373.

Right now we're just setting the text field width to gridUnit * 10, which adjusts with the font size, but not with the label length.
Comment 3 Bug Janitor Service 2023-06-21 04:27:28 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/1582
Comment 4 Nate Graham 2023-06-21 04:42:36 UTC
Git commit d647242cf5a5884ce00f641d747cec6497bd4d38 by Nate Graham.
Committed on 21/06/2023 at 04:25.
Pushed by ngraham into branch 'master'.

kcms/desktoppaths: always perfectly fit text

Previously the text fields' widths were hardcoded to gridUnit * 10. This
was not long enough for some text. Now, the fields all share a common
width that's equal to width long enough to fit the longest piece of
text, limited to a sane value to avoid overflowing the window.
FIXED-IN: 6.0

M  +9    -1    kcms/desktoppaths/ui/UrlRequester.qml
M  +51   -0    kcms/desktoppaths/ui/main.qml

https://invent.kde.org/plasma/plasma-desktop/-/commit/d647242cf5a5884ce00f641d747cec6497bd4d38
Comment 5 Patrick Silva 2023-06-29 13:11:23 UTC
Created attachment 159975 [details]
screenshot2

Desktop path is not entirely readable yet.
Comment 6 Nate Graham 2023-06-29 21:25:11 UTC
Fascinating. I wonder how the calculation used there could be wrong with that string. Will investigate.

What font and font size are you using?
Comment 7 Patrick Silva 2023-06-30 11:42:42 UTC
Created attachment 159999 [details]
font settings

I'm attaching my font settings.
Comment 8 Nate Graham 2023-07-11 16:09:43 UTC
Where can I get that font to test it out?
Comment 9 Patrick Silva 2023-07-11 16:13:01 UTC
Created attachment 160237 [details]
fonts

Fonts attached.
Comment 10 Nate Graham 2023-07-14 18:36:24 UTC
Aha, found the bug. It didn't actually have anything to do with the font at all, but rather the text length relative to the page width.
Comment 11 Nate Graham 2023-07-14 18:44:30 UTC
Git commit 2ead94b4841827348eb14227ca01d4557b420a13 by Nate Graham.
Committed on 14/07/2023 at 18:41.
Pushed by ngraham into branch 'master'.

kcms/desktoppaths: refine text field width calculation

Instead of using a fairly crude upper width limit of half the page
width (which caused long text to get cut off with narrow windows),
make the calculation more real-world by actually seeing how much
horizontal space is available on the page in a varity of conditions:
wide and narrow view, and when the page is scrollable as well as not.

M  +19   -1    kcms/desktoppaths/ui/main.qml

https://invent.kde.org/plasma/plasma-desktop/-/commit/2ead94b4841827348eb14227ca01d4557b420a13
Comment 12 Nate Graham 2023-07-14 18:45:32 UTC
Basically my "limited to a sane value to avoid overflowing the window" from the first commit turned out to not be so sane after all! Hopefully the new value should be much saner.
Comment 13 Patrick Silva 2023-08-01 20:02:43 UTC
This bug persists.
Comment 14 Nate Graham 2023-08-01 20:09:34 UTC
Sigh. Please attach another screenshot that shows it still happening.
Comment 15 Patrick Silva 2023-08-01 20:17:11 UTC
Created attachment 160668 [details]
screenshot2

Desktop path is still not entirely readable.
Comment 16 Nate Graham 2023-08-01 21:57:40 UTC
I cannot reproduce the issue no matter how I try.

Did this just start happening again when you upgraded to Qt 6.6 in Neon, by any chance? Or was it broken before Neon shipped Qt 6.6, and you're just now reporting the issue?
Comment 17 Patrick Silva 2023-08-01 22:19:30 UTC
The bug was fixed after closing this report and then reapppeared, I do not know when exactly.
Possibly after Qt 6.6.
Comment 18 Nate Graham 2023-08-01 22:20:37 UTC
I suspect it's Qt 6.6, then.

Can you run it in a terminal window with `systemsettings kcm_desktoppaths` and paste the output?
Comment 19 Patrick Silva 2023-08-01 22:27:48 UTC
$ systemsettings kcm_desktoppaths
kf.xmlgui: cannot find .rc file "systemsettingsui.rc" for component "systemsettings"
Using fontconfig file: "/home/stalker/.config/fontconfig/fonts.conf"
Hspell: can't open /usr/share/hspell/hebrew.wgz.sizes.
kf.sonnet.clients.hspell: HSpellDict::HSpellDict: Init failed
qt.qml.typeresolution.cycle: Cyclic dependency detected between "file:///usr/lib/x86_64-linux-gnu/qt6/qml/org/kde/desktop/private/MobileTextActionsToolBar.qml" and "file:///usr/lib/x86_64-linux-gnu/qt6/qml/org/kde/desktop/private/TextFieldContextMenu.qml"
qt.qml.typeresolution.cycle: Cyclic dependency detected between "file:///usr/lib/x86_64-linux-gnu/qt6/qml/org/kde/desktop/private/MobileTextActionsToolBar.qml" and "file:///usr/lib/x86_64-linux-gnu/qt6/qml/org/kde/desktop/Menu.qml"
qt.qml.typeresolution.cycle: Cyclic dependency detected between "file:///usr/lib/x86_64-linux-gnu/qt6/qml/org/kde/desktop/private/TextFieldContextMenu.qml" and "file:///usr/lib/x86_64-linux-gnu/qt6/qml/org/kde/desktop/Menu.qml"
qt.qml.typeresolution.cycle: Cyclic dependency detected between "file:///usr/lib/x86_64-linux-gnu/qt6/qml/org/kde/desktop/private/MobileTextActionsToolBar.qml" and "file:///usr/lib/x86_64-linux-gnu/qt6/qml/org/kde/desktop/private/TextFieldContextMenu.qml"
qt.qml.typeresolution.cycle: Cyclic dependency detected between "file:///usr/lib/x86_64-linux-gnu/qt6/qml/org/kde/desktop/private/MobileTextActionsToolBar.qml" and "file:///usr/lib/x86_64-linux-gnu/qt6/qml/org/kde/desktop/Menu.qml"
qt.qml.typeresolution.cycle: Cyclic dependency detected between "file:///usr/lib/x86_64-linux-gnu/qt6/qml/org/kde/desktop/private/TextFieldContextMenu.qml" and "file:///usr/lib/x86_64-linux-gnu/qt6/qml/org/kde/desktop/Menu.qml"
qt.qml.typeresolution.cycle: Cyclic dependency detected between "file:///usr/lib/x86_64-linux-gnu/qt6/qml/org/kde/desktop/private/MobileTextActionsToolBar.qml" and "file:///usr/lib/x86_64-linux-gnu/qt6/qml/org/kde/desktop/private/TextFieldContextMenu.qml"
qt.qml.typeresolution.cycle: Cyclic dependency detected between "file:///usr/lib/x86_64-linux-gnu/qt6/qml/org/kde/desktop/private/MobileTextActionsToolBar.qml" and "file:///usr/lib/x86_64-linux-gnu/qt6/qml/org/kde/desktop/Menu.qml"
qt.qml.typeresolution.cycle: Cyclic dependency detected between "file:///usr/lib/x86_64-linux-gnu/qt6/qml/org/kde/desktop/private/TextFieldContextMenu.qml" and "file:///usr/lib/x86_64-linux-gnu/qt6/qml/org/kde/desktop/Menu.qml"
qml: The item SubCategoryPage_QMLTYPE_116(0x555c89cc5ea0) is already in the PageRow
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
kf.coreaddons: "Could not find plugin "
file:///usr/lib/x86_64-linux-gnu/qt6/qml/org/kde/kirigami/ScrollablePage.qml:334: TypeError: Cannot read property 'activeFocus' of null (exception occurred during delayed function evaluation)
file:///usr/lib/x86_64-linux-gnu/qt6/qml/org/kde/kirigami/ScrollablePage.qml:334: TypeError: Cannot read property 'activeFocus' of null (exception occurred during delayed function evaluation)
Comment 20 Patrick Silva 2023-08-08 22:34:54 UTC
The requested information was provided.
Comment 21 Nate Graham 2023-08-09 13:38:27 UTC
I can't reproduce the issue when using the SF Pro Display (regular) font, and I'm out of ideas. I suspect a weird interaction between that font's metrics and something that Qt 6.6 does.

One final idea: does the issue reproduce for you when you use a long path that doesn't have any accented characters? Like get rid of the "Á" in there.
Comment 22 Patrick Silva 2023-08-09 14:00:55 UTC
Created attachment 160865 [details]
location without accent

Same result.
Comment 23 Nate Graham 2023-08-09 14:47:40 UTC
And to confirm, it works when using the Noto Sans font, right?
Comment 24 Patrick Silva 2023-08-09 19:37:45 UTC
Right.

By testing the default font settings and then reverting to SF Pro Display font I found the culprit: the font hinting.

open Fonts KCM
set the SF Pro Display font
set the font hinting to "Full"
apply the changes
close System Settings
open Locations KCM
Comment 25 Nate Graham 2023-08-11 16:50:50 UTC
Wow.

In this case there are two options for where the bug could be:
- In the font itself, for not properly settings its metrics for its various hinted states
- In Qt, for not properly deriving a size that takes into account proper hinted metrics

Either way, it's not our bug. And to be honest, my motivation to investigate any further is quite low given how difficult it is to encounter this issue. :)