Bug 421973

Summary: The selection rectangle in the views mode is smaller than the selected text and makes some later part of the text unreadable.
Product: [Applications] dolphin Reporter: dineshdevkota <dineshdevkota001>
Component: view-engine: details modeAssignee: Ismael Asensio <isma.af>
Status: RESOLVED FIXED    
Severity: normal CC: bugseforuns, elvis.angelaccio, isma.af, kfm-devel, nate
Priority: NOR Keywords: regression
Version: 20.04.1   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In: 20.07.70
Sentry Crash Report:
Attachments: selection on compact view mode
icon view

Description dineshdevkota 2020-05-23 12:24:07 UTC
SUMMARY
the selection rectangle in the views mode is smaller than the selected text and makes some later part of the text unreadable.


STEPS TO REPRODUCE
1. Update to version 20.04.1 of dolphin in Archlinux
2. Use the details view in dolphin
3. Select a file or folder and observe the selection rectangle

OBSERVED RESULT
The details are not quite found out but it seems to do the same regardless of the size of the window.
Other view modes are not effected.
The effect was observed in the breeze light theme. Breeze dark has the same issue with selection rectangle but the letters are visible.

EXPECTED RESULT
The selection and the selected item are supposed to be of same length.

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 5.6.13-arch1-1 64bit
(available in About System)
KDE Plasma Version: 5.18.5
KDE Frameworks Version: 5.70.0
Qt Version: 5.14.2

ADDITIONAL INFORMATION
Thank you!!
Comment 1 Ismael Asensio 2020-06-13 17:48:24 UTC
Created attachment 129321 [details]
selection on compact view mode
Comment 2 Nate Graham 2020-06-15 16:42:27 UTC
Will be fixed by https://invent.kde.org/system/dolphin/-/merge_requests/22
Comment 3 Nate Graham 2020-06-15 16:42:31 UTC
*** Bug 422772 has been marked as a duplicate of this bug. ***
Comment 4 Patrick Silva 2020-06-17 17:22:47 UTC
Created attachment 129460 [details]
icon view

Icon view is also affected on neon unstable.
Comment 5 Elvis Angelaccio 2020-07-12 21:28:06 UTC
Git commit 76a46fd9094b17eb99e8a42cca8562fdc0b3814c by Elvis Angelaccio, on behalf of Ismael Asensio.
Committed on 12/07/2020 at 21:28.
Pushed by elvisangelaccio into branch 'master'.

Fix selection rect after porting from QFontMetrics::width()

After porting from QFontMetrics::width() to QFontMetrics::boundigRect().width() in system/dolphin!10 we have a visual bug on selection rects, that can be seen on details and compact modes.

While from https://kdepepo.wordpress.com/2019/08/05/about-deprecation-of-qfontmetricswidth/ the use of `boundingRect()` would seem the right option to use (and I struggle to get the difference between the two methods when applied to a whole string and not a single char), in this case the `horizontalAdvance()` seems to return the value we need.
FIXED-IN: 20.07.70

M  +13   -13   src/kitemviews/kstandarditemlistwidget.cpp

https://invent.kde.org/system/dolphin/commit/76a46fd9094b17eb99e8a42cca8562fdc0b3814c
Comment 6 Elvis Angelaccio 2020-07-12 21:30:39 UTC
Git commit bf2eb0d69df085b30a7d7a7fad813ad958893c18 by Elvis Angelaccio, on behalf of Ismael Asensio.
Committed on 12/07/2020 at 21:30.
Pushed by elvisangelaccio into branch 'release/20.08'.

Fix selection rect after porting from QFontMetrics::width()

After porting from QFontMetrics::width() to QFontMetrics::boundigRect().width() in system/dolphin!10 we have a visual bug on selection rects, that can be seen on details and compact modes.

While from https://kdepepo.wordpress.com/2019/08/05/about-deprecation-of-qfontmetricswidth/ the use of `boundingRect()` would seem the right option to use (and I struggle to get the difference between the two methods when applied to a whole string and not a single char), in this case the `horizontalAdvance()` seems to return the value we need.
FIXED-IN: 20.07.70

M  +13   -13   src/kitemviews/kstandarditemlistwidget.cpp

https://invent.kde.org/system/dolphin/commit/bf2eb0d69df085b30a7d7a7fad813ad958893c18