[Qt-interest] Stopping QAction from parsing "&"

Nikos Chantziaras realnc at arcor.de
Thu Jun 10 23:54:59 CEST 2010


I never worked with the win32 API, so... meh :P


On 06/11/2010 12:51 AM, Jason H wrote:
> 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.



More information about the Qt-interest-old mailing list