[PATCH] Allow KConfigGroup to write any QVariant wrapped type

Thiago Macieira thiago at kde.org
Mon Mar 19 19:51:09 GMT 2007


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); }


-- 
  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20070319/6dcbe5e6/attachment.sig>


More information about the kde-core-devel mailing list