PDA

View Full Version : How to save the QColor and then read it?



ding
13th March 2010, 01:14
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.

ding
13th March 2010, 02:00
I have solved the problem.

vudvpro
4th May 2011, 10:55
QString BottonColor;
QColor color = QColorDialog::getColor(Qt::black, this);
if (color.isValid())
{
BottonColor = color.name();
}
settings.SetBottonColor(BottonColor);

/// read it.

QString strColor = settings.GetFontColor();
QColor color;
color.setNamedColor(strColor);