PDA

View Full Version : extra hard copy (as text) of QSettings



navid
5th December 2009, 08:33
Hello,

How can I have alternative hard copy as text (beside registry & others) of QSettings. unfortunately, the following code does not work.



QSettings _qsetsettings("ORG_NAME", "APP_NAME");
_qsetsettings.setPath(QSettings::IniFormat,
QSettings::UserScope,
QDir::currentPath());
_qsetsettings.setObjectName("MyIniFileName");
_qsetsettings.sync();


regards,
n_navid

wysota
5th December 2009, 09:21
Just copy the file.

QSettings settings;
//...
QFile::copy(settings.fileName(), "someotherplace");

navid
5th December 2009, 09:40
thanks for reply,
but it returns false


bool _bres = QFile::copy(_qsetsettings.fileName(), _qspath+"/"+_qsname);

it seems, it cant find path of _qsetsettings.fileName() .

navid
5th December 2009, 10:29
qDebug()<<"source: "<<_qsetsettings.fileName()<<" dest: "<<_qspath+"/"+_qsname <<" Res: "<<_bres;

source: "\HKEY_CURRENT_USER\Software\ORG_NAME\APP_NAME" dest: "G:/qt/prj/debug/settings.txt" Res: false

wysota
5th December 2009, 12:29
Well, you didn't say you want to copy the settings from registry. Obviously there is no file name for it. You have to copy keys one by one yourself then.

navid
5th December 2009, 14:05
to copy keys one by one yourself
excellent man! ;)