PDA

View Full Version : QColor value into SQLlite?



Gavin Harper
16th March 2011, 12:37
Is it possible to set a QColor, then save it into SQLite in some form then be able to easily reload it?

I would appreciate any help!

Thank you!

mcosta
16th March 2011, 13:15
You can write a QColor on a QByteArray with QDataStream and then write in a SQLITE db as BLOB

Gavin Harper
16th March 2011, 18:11
How would I transfer back if I have saved it to the DB as .name() thus giving the #00FF00 format?

Octal
16th March 2011, 18:22
You could use the QColor constructor taking a const char * parameter :
QColor::QColor ( const char * name ) or the QString one :
QColor::QColor ( const QString & name )