getting the internal name of a KAction

Jason Harris kstars at 30doradus.org
Mon Feb 19 20:23:16 GMT 2007


Actually, nevermind.  Thinking about this more, I can easily just add 
setObjectName() myself in the few cases where I actually need the name. 
  In most cases, the action pointer itself is fine.

So unless other people need to access the internal action names, I 
withdraw my inquiry.

thanks,
Jason

> Hello,
> 
> With revision 621518 (by Haussmann), the KAction ctors no longer call 
> QAction->setObjectName().  As a result, the name of the KAction is no 
> longer accessible.
> 
> In KActionCollection, it is possible to identify an action given a name, 
> but one cannot retrieve the name given an action.  I' like to be able to 
> do this.  My use case is that I have a slot in which I construct the 
> name of a data file based on the name of the invoking action:
> 
> void KStars::slotColorScheme() {
> 	QString filename = QString( sender()->objectName() ) + ".colors";
> 	loadColorScheme( filename );
> }
> 
> I see that KAction no longer passes a name parameter in the ctor, but 
> the names must be stored in KActionCollection, since we have 
> action(QString name).  Can we also have:
> 
> QString KActionCollection::actionName( KAction *a )
> 
> thanks,
> Jason





More information about the kde-core-devel mailing list