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

List:       kde-devel
Subject:    Re: Writing QLists in KConfig values
From:       Albert Astals Cid <aacid () kde ! org>
Date:       2008-05-16 22:58:02
Message-ID: 200805170058.02967.aacid () kde ! org
[Download RAW message or body]

A Divendres 16 Maig 2008, Stefan Majewsky va escriure:
> Hi,
>
> I'm attempting to store two lists in a KConfig file. The first one is a
> QList<Item>, where Item is a self-defined class with a copy-constructor,
> operator=, as well as operator<< and operator>> for QDataStreams. The
> second one is a QUuidPairList, defined
>
>  typedef QList<QPair<QUuid, QUuid> > QUuidPairList;
>
> (The typedef avoids the comma in the type name which might be confusing for
> preprocessor macros.) Now, I would like to read both lists from a
> KConfigGroup like this:
>
>  m_itemList = cg.readEntry("Items", QList<Item>());
>  m_pairList = cg.readEntry("UuidPairs", QUuidPairList());
>
> Now when I build that, some errors occur for QUuidPairList. I have attached
> them at the end of the mail (see [2]), you can also find them in a more
> readable manner at [1]. For QList<Item> where similar errors were shown, I
> solved the problem by inserting the following into item.h:
>
>  #include <conversion_check.h>
>  Q_DECLARE_METATYPE(Item)
>  namespace ConversionCheck
>  {
>      QVConversions(Item, supported, supported);
>  }
>
> A similar approach does not work for QUuidPairList, the errors do not
> change. What is the problem?

When you said a similar approach does not work for QUuidPairList you mean you 
did

typedef QPair<QUuid, QUuid> QUuidPair;
Q_DECLARE_METATYPE(QUuidPair)
namespace ConversionCheck
{
    QVConversions(QUuidPair, supported, supported);
}

?

>
> Stefan Majewsky
>
 
>> 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