[Qt-interest] Stopping QAction from parsing "&"
Nikos Chantziaras
realnc at arcor.de
Thu Jun 10 22:33:35 CEST 2010
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.
More information about the Qt-interest-old
mailing list