-2

Can I get a line of code that saves text of QLineedit and on restarting the app , it is retrieved ? Please help , its very important for my project …

rajatgupta431
  • 121
  • 1
  • 2
  • 10

1 Answers1

1
 //read 
 QSettings settings("settingName");
 QString aValue=settings.value("aKey").toString();


 //write
 QSettings settings("settingName");
 QString somevalue=textedit.text();
 settings.setValue("aKey",somevalue);
Luca Rocchi
  • 6,272
  • 1
  • 23
  • 23
  • 1
    Furthermore, the read can be in the ctor of your QMainWindow (or in general, QWidget) and the write in your reimplementation of QWidget::closeEvent(QCloseEvent*) in the QWidget or derivate. – Manjabes Mar 20 '13 at 08:36