Bug 493279

Summary: Dolphin 'Information Panel' applies word wrap for file name, so copied name is word wrapped by newline symbols
Product: [Applications] dolphin Reporter: reports_go_brrr <goodaqua>
Component: panels: informationAssignee: Dolphin Bug Assignee <dolphin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: daninshed, kfm-devel, liweinan
Priority: NOR    
Version First Reported In: 24.12.2   
Target Milestone: ---   
Platform: Other   
OS: Other   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Showcase
In the figure, the red box shows the result before modification, and the green box shows the result after modification (using QTextEdit).

Description reports_go_brrr 2024-09-17 16:34:10 UTC
Created attachment 173781 [details]
Showcase

SUMMARY
Dolphin 'Information Panel' applies word wrap for file name so copied name is word wrapped too.

STEPS TO REPRODUCE
1. Make a file with many words in it
2. Open "Information Panel" (F11)
3. Select that file
4. Shrink width of panel to see word wrap
5. Select and copy file name
6. Open any text editor
7. Paste word wrapped file name

OBSERVED RESULT
Now you can see it is word wrapped. So regularly it annoys me.

EXPECTED RESULT
Mo make it copy file name as if it was one string or simular to how I'd copied file name by Ctrl+Alt+C but without paths.

SOFTWARE/OS VERSIONS
Operating System: EndeavourOS
KDE Plasma Version: 6.1.5
KDE Frameworks Version: 6.5.0
Qt Version: 6.7.2
Kernel Version: 6.10.9-arch1-2 (64-bit)
Graphics Platform: X11

ADDITIONAL INFORMATION
Vanilla Dolphin, vanilla KDE Plasma, vanilla EndeavourOS.
Comment 1 Bug Janitor Service 2025-09-10 07:22:12 UTC
A possibly relevant merge request was started @ https://invent.kde.org/system/dolphin/-/merge_requests/1050
Comment 2 liweinan@kylinos.cn 2025-09-11 02:05:20 UTC
Created attachment 184875 [details]
In the figure, the red box shows the result before modification, and the green box shows the result after modification (using QTextEdit).
Comment 3 Méven 2025-09-12 08:40:24 UTC
Git commit 112f375ec175e5aedfb58a3a3bf76535cc959575 by Méven Car, on behalf of Weinan Li.
Committed on 12/09/2025 at 08:29.
Pushed by meven into branch 'master'.

informationpanel: use QTextEdit for filename display to avoid newlines in copied text

QLabel does not support line wrapping at arbitrary positions. The original code achieved word wrap by manually adding newline characters to the text, which resulted in these newlines being included when the filename was selected and copied.

This patch replaces QLabel with QTextEdit for filename display, leveraging QTextEdit's built-in word wrap functionality that handles line breaks purely for display without modifying the underlying text. This ensures copied filenames remain free of unintended newlines.

M  +13   -24   src/panels/information/informationpanelcontent.cpp
M  +2    -1    src/panels/information/informationpanelcontent.h

https://invent.kde.org/system/dolphin/-/commit/112f375ec175e5aedfb58a3a3bf76535cc959575