rajatgupta431
rajatgupta431

Reputation: 119

Remember Last QLineEdit data

My App takes input for Id and Birthdate in QLineEdit and sends the form data as http post request. Is it possible for the last entered input to stay when app is closed and then restarted??

Upvotes: 1

Views: 1056

Answers (1)

Chris
Chris

Reputation: 17545

Short answer: Use QSettings

For example:

QSettings settings(QSettings::UserScope);
settings.setValue("Birthdate", date);

then...

QSettings settings(QSettings::UserScope);
dateLineEdit->setText(settings.value("Birthdate").toString());

See the documentation regarding scope and file formats and determine what usage suits your needs best.

Upvotes: 2

Related Questions