[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: KMenu weirdness with accelerator char
From:       Michael Jansen <kde () michael-jansen ! biz>
Date:       2009-08-29 14:58:13
Message-ID: 200908291658.13302.kde () michael-jansen ! biz
[Download RAW message or body]

Accelerator Manager is the problem. Have a look at commit 1012027 for one 
solution (KGlobal::locale()->removeAcceleratorMarker()).

There is also the possibility to exclude your widget from the accelerator 
manager but i don't remember how.

Mike

On Saturday 29 August 2009 15:49:00 you wrote:
> Hi,
> 
> I've got a problem with KMenu (in kmail) in trunk:
> It inserts a list of strings for some actions (in this case each string is
>  an email address). Whenever the result of menu.exec() is asked for its
>  text(), the text contains an "&" accelerator character.
> 
> Using the same code but just QMenu instead, does not show this behavior.
> I looked through KMenu's code but couldn't find the problem (as
>  setKeyboardShortcutsEnabled is OFF by default)
> 
> Code:
> 
>   KMenu menu( this );
>   menu.setObjectName( "Addresschooser" );
>   for ( QStringList::const_iterator it = emails.begin(), end = emails.end()
>  ; it != end; ++it ) {
>     kDebug() << *it;
>     menu.addAction( *it );
>   }
>   const QAction *result = menu.exec( QCursor::pos() );
>   if ( !result )
>     return;
>     kDebug() << "result:" << result->text();
> 
> 
> The debug output:
> kmail(7045) KMLineEdit::insertEmails: "martin.koller@etm.at"
> kmail(7045) KMLineEdit::insertEmails: "koller@etm.at"
> kmail(7045) KMLineEdit::insertEmails: "martin.b.koller@siemens.com"
> kmail(7045) KMLineEdit::insertEmails: result: "&koller@etm.at"
> 
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic