C.Xammar
C.Xammar

Reputation: 167

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.

Upvotes: 1

Views: 231

Answers (1)

arturx64
arturx64

Reputation: 953

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

Upvotes: 2

Related Questions