readEntry and booleans

Thomas Braxton brax108 at cox.net
Wed Jan 4 20:04:17 GMT 2006


On Wednesday 04 January 2006 12:11, Thomas Braxton wrote:
> On Wednesday 04 January 2006 05:04, André Wöbbeking 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
> or canConvert. It seems that canConvert only checks if the conversion is
> possible & convert checks if the conversion fails. I need to look at the Qt
> code a little more closely to see what to do.

Replying to myself :)

After looking at the Qt code that is what canConvert/convert do. So here is 
another try, it also checks the items in a QVariantList. If you uncomment the 
writeEntry in kconfigtest.cpp it will crash, because there is no conversion 
from QPoint or QSize to QString through QVariant. Which leads me to the next 
question, should I cause an assertion failure or just issue a debug/warning 
message? I'm not sure a crash is the best policy here.

Regards,
Thomas




More information about the kde-core-devel mailing list