Thanks to the Mole for trying to help with my previous post, but the problem remains.

I'm just trying to set the window color and save it so I can restore it on startup, and it's not working. When I try to get the color to save it to the database, the color is empty or invalid.
Here's the code:

Qt Code:
  1. void MainWindow::setColors() {
  2. QColor color = QColorDialog::getColor();
  3. QPalette palette = QPalette(color);
  4. QApplication::setPalette(palette);
  5.  
  6. QSettings settings(this);
  7. settings.setValue("MainWindow/Color", color);
  8. }
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. void MainWindow::saveLook() {
  2. QSettings settings(this);
  3. QString color = settings.value("MainWindow/Color").toString(); // tried .value<QColor>() and it didn't work either
  4. QFont font = settings.value("MainWindow/Font").value<QFont>();
  5.  
  6. qDebug() << "save color will be " << color;
  7. qDebug() << "save font will be " << font;
  8.  
  9.  
  10. QSqlDatabase db = QSqlDatabase::database(ctrlConn);
  11. QSqlQuery query(db);
  12. query.prepare("UPDATE settings set color =?, font =? where id=1");
  13. query.addBindValue(color);
  14. query.addBindValue(font);
  15. query.exec();
  16.  
  17. qDebug() << "saving look " << query.lastError();
  18. }
To copy to clipboard, switch view to plain text mode 

The problem is (just for Wysota ) qDebug() save color is empty.
If I use .value<QColor>() instead of .toString(), the qDebug() says the color is invalid.

I just want to save the user chosen color to my database and restore it on start up.
Any ideas?