[Interest] Disable automatic shortcuts for certain widgets?

Ben Haller bhaller at mac.com
Tue Jun 9 18:19:47 CEST 2020


Why not just replace ‘&’ with ‘&&’ in the string the user inputs, before setting it as the name on the tab?

Cheers,
-B.

Benjamin C. Haller
Messer Lab
Cornell University


> On Jun 9, 2020, at 11:39 AM, Murphy, Sean <smurphy at walbro.com> wrote:
> 
> In our application, we have a QTabWidget. We allow the users to rename the tabs. One of our users discovered that if they put an '&' in the string, it isn't displayed, and if they put two together in sequence ("&&"), a single '&' is displayed on the tab widget.
> 
> I completely understand what's happening, the text they are entering is being evaluated by the native widgets for the presence of the '&' character to automatically create shortcuts as described here: https://doc.qt.io/qt-5/qabstractbutton.html#text-prop.
> 
> In other parts of our application, I do want the automatic shortcut functionality (i.e. having the &File for the File menu is something I'd like to keep), but for this specific tab widget I'd like to disable that functionality since our users aren't software developers and they find it weird that the ampersand character behaves differently than other characters in the string.
> 
> I don't see any way to disable that functionality though, is there one that I'm missing?
> 
> Sean
> 
> 
> 
> 
> This message has been scanned for malware by Forcepoint. www.forcepoint.com
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> https://lists.qt-project.org/listinfo/interest



More information about the Interest mailing list