KSelectAction

Clarence Dang dang at kde.org
Fri Jul 21 09:10:40 BST 2006


On Wednesday 19 July 2006 16:11, Stephan Kulow wrote:
> Am Dienstag, 18. Juli 2006 15:45 schrieb Clarence Dang:
> > 3. currentText() returns "&MyString" (i.e. it adds the accelerator)
> > instead of "MyString" (where "MyString" is passed to setItems()).  This
> > is unexpected and a subtle change from KDE 3.
>
> The accelerators are added most likely by kcheckaccelerator

yep, KApplication -> KCheckAccelerator -> KAcceleratorManager -> 
KPopupAccelManager

This behaviour appears to be a global KAction bug/feature, not limited to 
KSelectAction.  text() returns what you passed to setText() or the KAction 
ctors, but with an extra accelerator.  This is due to increased coupling of 
actions with the GUI:

KDE 4 sets the action's text to have an accelerator:
void KPopupAccelManager::setMenuEntries(const KAccelStringList &list)
{
  QAction *maction;
[...]
  maction->setText(list[cnt].accelerated());

KDE 3 does not act on the action's text directly:
void KPopupAccelManager::setMenuEntries(const KAccelStringList &list)
{
  QMenuItem *mitem;
[...]
  mitem->setText(list[cnt].accelerated());

I'm not sure whether the new behaviour makes sense.  Probably not though as 
text() and setText() should be "symmetric"?




More information about the kde-core-devel mailing list