--Boundary-00=_M/AvDXGPVB4GAeJ Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Wednesday 04 January 2006 05:04, Andr=E9 W=F6bbeking wrote: > 1) can we check if the QVariant is convertable (see > qVariantCanConvert()) at least for debug code? how about something like this patch? I'm not sure if I should use convert o= r=20 canConvert. It seems that canConvert only checks if the conversion is=20 possible & convert checks if the conversion fails. I need to look at the Qt= =20 code a little more closely to see what to do. --Boundary-00=_M/AvDXGPVB4GAeJ Content-Type: text/x-diff; charset="iso-8859-15"; name="diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="diff" Index: kconfigbase.h =================================================================== --- kconfigbase.h (revision 494324) +++ kconfigbase.h (working copy) @@ -1603,8 +1603,11 @@ QList list; if (!vList.isEmpty()) { - foreach (QVariant aValue, vList) + QVariant::Type wanted = QVariant(T()).type(); + foreach (QVariant aValue, vList) { + Q_ASSERT(aValue.convert(wanted)); list.append( qvariant_cast(aValue) ); + } } return list; @@ -1614,6 +1617,7 @@ void KConfigBase::writeEntry( const char* pKey, const QList& rValue, bool bPersistent, bool bGlobal, bool bNLS ) { + Q_ASSERT(!rValue.isEmpty() && QVariant(rValue.first()).convert(QVariant::String)); QVariantList vList; foreach(T aValue, rValue) vList.append(aValue); --Boundary-00=_M/AvDXGPVB4GAeJ--