Howto create a KLocalizedString from a QString?

Andreas Pakulat apaku at
Sun Mar 15 22:31:59 GMT 2009


First a bit of background:
In KDevelop plugins can be written via scripts (using Kross), however
they still appear like full blown plugins as they ship their own
.desktop file. To load such script-plugins we have a C++ written plugin
that manages the whole kross stuff, this plugin needs a componentdata
and of course also a kaboutdata object.

Now it would of course be good if that KAboutData is filled from the
script plugin info, i.e. from its .desktop file. However thats a problem
as KAboutData only accepts either QByteArray or KLocalizedString for the
various fields (appname, name, short description). While QByteArray is
not a big deal there's apparently no way to create a KLocalizedString if
I already have a fully translated string read in from the desktop file.

My current workaround is to create a copy of the backing char* from the
desktop-file property and hand that to KLocalizedString, but that feels
like a hack.

So my question is: Can we add a constructor to KLocalizedString taking a
QString, or adjusting KAboutData to introduce setter methods that use


Good news.  Ten weeks from Friday will be a pretty good day.

More information about the kde-core-devel mailing list