[PATCH] Allow KConfigGroup to write any QVariant wrapped type

Andreas Pakulat apaku at gmx.de
Mon Mar 19 20:50:58 GMT 2007


On 19.03.07 21:40:35, Andreas Pakulat wrote:
> On 19.03.07 20:51:09, Thiago Macieira wrote:
> > Andreas Pakulat wrote:
> > >while revisiting my KConfigXT patch I came across a problem, because
> > >KConfigGroup uses the QVariant() constructor. This makes it (AFAICS)
> > >impossible to use KUrl::List (for example) with writeEntry<> or
> > >readEntry<>, at least I get a bunch of errors because there's no
> > >QVariant constructor for that.
> > 
> > For any type that has a Q_DECLARE_METATYPE, I suggest adding the following 
> > method to the class definition:
> > 
> >   inline operator QVariant() const { return qVariantFromValue(*this); }
> 
> Hmm, yeah that would work too and it would solve similar issues in other
> places. 
> 
> Although I already committed, it can be easily reverted and this change
> applied.
> 
> Currently I see Q_DECLARE_METATYPE used in kdelibs for:
> 
> KTextEditor::Document*
> KUrl
> KUrl::List (in my local copy due to adding UrlList to KConfigXT)
> KJob*

Ooops, my grep wasn't finished yet :) So the rest are:

KMenuContext (kdeui)
KJS::DebugDocument* (khtml)
KFileItem (kio)
StringStringMap (kio)
QList<int> (kioslave)
PointerBase* (kjsembed)
StringStringMap (kwallet) - seems like a duplicate from kio?
StringToStringStringMap (kwallet)
StringByteArrayMap (kwallet)
Phonon:State (phonon tests) - maybe this should be moved to the
Phonon::State class declaration?

Andreas

-- 
You will gain money by a fattening action.




More information about the kde-core-devel mailing list