Qt-interest Archive, January 2008
QVariant::save: unable to save type 67
Message 1 in thread
Hi,
I'm using QVariant to store my settings in a QSettings instance. On
Win32 it works fine, but under Linux I can't store
QColors. For example:
QSettings settings;
QVariant color ( QColor ( 255, 255, 255 ) )
settings.setValue ( "/Test", color )
When writing the settings to disk I receive the following error on the console:
QVariant::save: unable to save type 67
From the Qt source code I understand that type 67 is a QColor.
This is for Qt 4.3.1 and I'm linking to QtCore and QtGui.
Does anyone know what is causing this?
best,
Jeroen
--
[ signature omitted ]
Message 2 in thread
From the documentation @
http://doc.trolltech.com/4.3/qsettings.html#qvariant-and-gui-types
Because QVariant is part of the QtCore library, it cannot provide
conversion functions to data types such as QColor, QImage, and QPixmap,
which are part of QtGui. In other words, there is no toColor(),
toImage(), or toPixmap() functions in QVariant.
Instead, you can use the QVariant::value() or the qVariantValue()
template function.
- Joaquin Luna
--
[ signature omitted ]
Message 3 in thread
On Jan 16, 2008 4:32 PM, Joaquin Luna <Joaquin.Luna@xxxxxxxx> wrote:
> From the documentation @
> http://doc.trolltech.com/4.3/qsettings.html#qvariant-and-gui-types
>
snip
>
> Instead, you can use the QVariant::value() or the qVariantValue()
> template function.
That's not my problem, I am actually using the construct:
settings.value("DataPump/bgcolor").value<QColor>();
My problem is that, when using QSettings, on Linux it can't save a
QColor QVariant. However the same code on Win32 does work. That said,
the icons are also not displaying in Linux, so perhaps something very
basic is wrong with my Linux build. I just don't know what!
best,
Jeroen
P.S.: Joaquin: Sorry for sending the message to your private address initially.
--
[ signature omitted ]