[Qt-interest] Stopping QAction from parsing "&"
Jason H
scorp1us at yahoo.com
Thu Jun 10 23:51:09 CEST 2010
This dates back to old Win32API days...
----- Original Message ----
From: Nikos Chantziaras <realnc at arcor.de>
To: qt-interest at trolltech.com
Sent: Thu, June 10, 2010 4:33:35 PM
Subject: Re: [Qt-interest] Stopping QAction from parsing "&"
On 06/10/2010 11:14 PM, Colin S. Miller wrote:
> Nikos Chantziaras wrote:
>> I have a QMenu where I add QActions using the
>>
>> QMenu::addAction(const QString& text)
>>
>> function. Problem is, 'text' contains filenames (you guessed it; it's
>> for a "Recent Files" menu), and some of the filenames contain "&"
>> characters. This gets parsed and generates a shortcut. That's wrong,
>> of course. How do I prevent this from happening?
>
> Nikos,
> The standard was of doing this is to double the &.
>
> Use myString.replace("&", "&&")
Thank you. Didn't think of that. I was trying "\&" and wasn't able to
find anything in the docs.
_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest
More information about the Qt-interest-old
mailing list