PDA

View Full Version : Settings problem



waynew
24th January 2010, 21:26
When this:

QFont font = settings.value("MainWindow/Font").value<QFont>();

Returns a valid font value,
why doesn't this:

QColor color = settings.value("MainWindow/Color").value<QColor>();

Return a valid color value?

squidge
24th January 2010, 21:56
Just a guess here, but the default constructor for QFont returns a valid font (the applications default font), whereas the default constructor for QColor initialises to an invalid color.

waynew
24th January 2010, 22:44
Possible, but the example in the QSettings doc is:

QColor color = settings.value("DataPump/bgcolor").value<QColor>();

squidge
24th January 2010, 22:58
If the key doesn't exist, your still left with the default though.