Results 1 to 3 of 3

Thread: How to save the QColor and then read it?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default How to save the QColor and then read it?

    I want to store the value of QColor,but I don't know how to store it and read it. I try to use QVariant ,but I failed.

  2. #2
    Join Date
    Jan 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to save the QColor and then read it?

    I have solved the problem.

  3. #3
    Join Date
    Mar 2011
    Location
    Việt Nam
    Posts
    8
    Thanks
    3
    Qt products
    Qt3 Qt4 Qt/Embedded Qt Jambi PyQt3 PyQt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60

    Default Re: How to save the QColor and then read it?

    Qt Code:
    1. QString BottonColor;
    2. QColor color = QColorDialog::getColor(Qt::black, this);
    3. if (color.isValid())
    4. {
    5. BottonColor = color.name();
    6. }
    7. settings.SetBottonColor(BottonColor);
    8.  
    9. /// read it.
    10.  
    11. QString strColor = settings.GetFontColor();
    12. QColor color;
    13. color.setNamedColor(strColor);
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Replies: 2
    Last Post: 2nd September 2009, 13:36
  2. RGB QColor(QRgb)
    By weixj2003ld in forum General Programming
    Replies: 5
    Last Post: 28th August 2009, 02:10
  3. question with QColor
    By Devora in forum Qt Programming
    Replies: 2
    Last Post: 23rd June 2009, 10:49
  4. bug with QColor(QString& name)
    By Radagast in forum Qt Programming
    Replies: 1
    Last Post: 31st July 2008, 14:24
  5. read files and save the,
    By kernel_panic in forum Qt Programming
    Replies: 2
    Last Post: 4th January 2007, 06:31

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
  •  
Qt is a trademark of The Qt Company.