Bug 448269 - Problem with '&' symbol in the title of user action
Summary: Problem with '&' symbol in the title of user action
Status: CONFIRMED
Alias: None
Product: krusader
Classification: Applications
Component: general (other bugs)
Version First Reported In: Git
Platform: Debian stable Linux
: NOR normal
Target Milestone: ---
Assignee: Krusader Bugs Distribution List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-01-11 16:33 UTC by Dmitry Yasenovsky
Modified: 2024-12-05 15:09 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitry Yasenovsky 2022-01-11 16:33:20 UTC
SUMMARY
Problem with '&' symbol in the title of user action

STEPS TO REPRODUCE
1.  Useractions > Manage User Action... > Create New User Action
2.  Please enter Title with '&' symbol. For example:
Title: Compress JPEG & PNG
Tooltip: Compress JPEG & PNG
Description: Compress JPEG & PNG
Command: kdialog --title 'Compress JPEG & PNG' --yesno 'Do you want to compress selected JPEG & PNG files?'
3.  Press Apply & Close
4. Useractions > Manage User Action... 
Select "Compress JPEG & PNG" in list of user actions.
You can see that the Title has changed.
Title: "Compress JPEG  &PNG" ('&' symbol has shifted from its original position)
5. Press Close
6. Useractions > 
Find 'Compress JPEG & PNG' in the falling list of useractions. You can see that '&' symbol is not displayed in the title: 'Compress JPEG  PNG'.

OBSERVED RESULT
The '&' symbol in the Title is shifted in some cases and not shown in others. 

EXPECTED RESULT
'&' symbol in the correct position.

SOFTWARE/OS VERSIONS
Linux:  Debian GNU/Linux 11 (bullseye)
Kernel Version: 5.10.0-10-amd64
KDE Plasma Version:  5.20.5
KDE Frameworks Version: 
Qt Version:  5.15.2
Comment 1 Alex Bikadorov 2024-12-05 15:09:21 UTC
The user action title string is set as QAction::text property and ampersand characters are interpreted as mnemonic for the action. 

Workaround: To use an ampersand in the title, write "&&" (see https://doc.qt.io/qt-6/qaction.html#text-prop).

Big question is why ampersand characters are inserted into the QAction::text property and visible in the UI. This was a bug in KDE frameworks but should be fixed for a long time now, see bug 337491.