Search code examples
c++qtqsettings

QSettings simple task not working


I'm trying to use QSettings on my code but it's not working correctly. My code is:

In Mainwindow.h
QSettings settings

(I have declared before all setOrganizationName setOrganizationDomain setApplicationName)

In Mainwindow.cpp
settings.setValue("smtp/email", "test");
qDebug() << settings.value("smtp/email").toString();

But the qDebug is returning me ""

I believe it's a simple use of QSettings but it's not working.


Solution

  • For efficiency, the changes may not be saved to permanent storage immediately. (You can always call sync() to commit your changes.)