Strange ampersand in Plasma tooltips

Mark Kretschmann kretschmann at kde.org
Tue Mar 2 10:07:26 CET 2010


On Mon, Mar 1, 2010 at 4:02 PM, Thomas Lübking <thomas.luebking at web.de> wrote:
> First off, it's not in yesterdays build with 4.4.0
>
> Then:
> the plasma::iconwidget in applet and and amarok::iconbutton are different
> implementations and not based on each other, so it's unlikely in them.
>
> ==> The reason would be that the corrensponding QAction::text()'s contain
> them, what's wrong.
>
> long story short: don't ever QAction::setText(&Mnemonic) but
> QAction::setText(Mnemonic) QAction::setShortcut(Qt::Ctrl+Qt::Key_M)
>
> FYI, about mnemonics - "little nasty things with a little nasty name" ;-)
> ------
> the flags of QPainter::drawText() take (among others)
> - Qt::TextShowMnemonic
> - Qt::TextHideMnemonic
>
> where the first will print "&Last.fm: Love" as "_L_ast.fm: Love" and the
> second as "Last.fm: Love"
> If you omit them both, you'll just get the text as it is.
>
> If you want to support mnemonics AND ampersands, you'll have to pass latter as
> "&&"
>
> Neither QLabel nor QToolTip by default support mnemonics*, so you'll have to
> get rid of the mnemonic '&' when setting the tooltip, BUT if you pass them by
> "set(Icon)Text" and "setShortcut" that's not necessary as the action
> representation (menuitem, toolbutton) will make up mnemonic string itself and
> pass it to the style for painting... (which can then still decide to block
> them)
>
> *they call QStyle::DrawItemText() which does not support text flags, nor
> widget types w/o hacking. also they're inactive.

Sorry Thomas, I must admit you lost me here.

Do you know how to fix this in Amarok, or not? If so, please try to
explain how to fix it :)

-- 
Mark Kretschmann
Amarok Developer, Software Engineer at Collabora Ltd
Fellow of the Free Software Foundation Europe
http://amarok.kde.org - http://www.fsfe.org - http://collabora.co.uk


More information about the Amarok-devel mailing list