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

List:       kde-devel
Subject:    actionCollection()->addAction( "edit_new" ) not acting as expected
From:       "dave selby" <dave6502 () googlemail ! com>
Date:       2007-05-24 21:04:22
Message-ID: f52017b60705241404v288c05c9wec08c500923908c4 () mail ! gmail ! com
[Download RAW message or body]

Hi all,

I am looking at some code ...

  QAction* newAct = actionCollection()->addAction( "edit_new" );
  newAct->setText( i18n("&New...") );
  newAct->setIcon( KIcon("document-new") );
  qobject_cast<KAction*>( newAct
)->setShortcut(KStandardShortcut::shortcut(KStandardShortcut::New));
  connect(newAct, SIGNAL(triggered(bool)), SLOT(slotEditNew()));

The key part being ...

  QAction* newAct = actionCollection()->addAction( "edit_new" );

According to Kross::ActionCollection Class Reference, this gives the
action 'newAct' a name - in this case "edit_new".

There is a connect in the form ...

  connect(editMenu,SIGNAL(hovered(QAction*)),this,SLOT(statusEditCallback(QAction*)));

Followed by ...

void KTApp::statusEditCallback(QAction* action)
{
  cout << "XXXXXXXXX" << action->name() << endl;

And I end up with zip but a lot of X's whenever I hover over the 'new'
option. I get the expected result when I action->text() but then I get
'&New ...' not 'edit_new' !

Interestingly the KStandardAction cut, copy, paste work as expected
and returns 'edit_cut', 'edit_copy' ... etc.

Have been googleing & struggling on this - documentation on
'actionCollection' seems a bit light :)

Any ideas as to whats happening

Cheers

Dave





-- 

The unavoidable price of reliability is simplicity.

-- C.A.R. Hoare
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

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