Results 1 to 4 of 4

Thread: QColor value into SQLlite?

  1. #1
    Join Date
    Aug 2010
    Posts
    28
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QColor value into SQLlite?

    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!

  2. #2
    Join Date
    Jan 2006
    Location
    Napoli, Italy
    Posts
    621
    Thanks
    5
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QColor value into SQLlite?

    You can write a QColor on a QByteArray with QDataStream and then write in a SQLITE db as BLOB
    A camel can go 14 days without drink,
    I can't!!!

  3. #3
    Join Date
    Aug 2010
    Posts
    28
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QColor value into SQLlite?

    How would I transfer back if I have saved it to the DB as .name() thus giving the #00FF00 format?

  4. #4
    Join Date
    Nov 2010
    Posts
    20
    Thanks
    1
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QColor value into SQLlite?

    You could use the QColor constructor taking a const char * parameter :
    Qt Code:
    1. QColor::QColor ( const char * name )
    To copy to clipboard, switch view to plain text mode 
    or the QString one :
    Qt Code:
    1. QColor::QColor ( const QString & name )
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Qcolor as Hex format ?
    By augusbas in forum Qt Programming
    Replies: 2
    Last Post: 23rd November 2012, 23:06
  2. Replies: 2
    Last Post: 1st May 2010, 15:23
  3. QTableView and SqlLite
    By Myrgy in forum Qt Programming
    Replies: 1
    Last Post: 4th October 2009, 15:54
  4. RGB QColor(QRgb)
    By weixj2003ld in forum General Programming
    Replies: 5
    Last Post: 28th August 2009, 03:10
  5. question with QColor
    By Devora in forum Qt Programming
    Replies: 2
    Last Post: 23rd June 2009, 11:49

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.