Results 1 to 6 of 6

Thread: extra hard copy (as text) of QSettings

  1. #1
    Join Date
    Oct 2009
    Posts
    90
    Thanks
    4
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default extra hard copy (as text) of QSettings

    Hello,

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

    Qt Code:
    1. QSettings _qsetsettings("ORG_NAME", "APP_NAME");
    2. _qsetsettings.setPath(QSettings::IniFormat,
    3. QSettings::UserScope,
    4. QDir::currentPath());
    5. _qsetsettings.setObjectName("MyIniFileName");
    6. _qsetsettings.sync();
    To copy to clipboard, switch view to plain text mode 

    regards,
    n_navid
    Last edited by navid; 5th December 2009 at 08:54.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: extra hard copy (as text) of QSettings

    Just copy the file.
    Qt Code:
    1. QSettings settings;
    2. //...
    3. QFile::copy(settings.fileName(), "someotherplace");
    To copy to clipboard, switch view to plain text mode 
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Oct 2009
    Posts
    90
    Thanks
    4
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: extra hard copy (as text) of QSettings

    thanks for reply,
    but it returns false

    Qt Code:
    1. bool _bres = QFile::copy(_qsetsettings.fileName(), _qspath+"/"+_qsname);
    To copy to clipboard, switch view to plain text mode 

    it seems, it cant find path of _qsetsettings.fileName() .
    Last edited by navid; 5th December 2009 at 09:53.

  4. #4
    Join Date
    Oct 2009
    Posts
    90
    Thanks
    4
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: extra hard copy (as text) of QSettings

    Qt Code:
    1. qDebug()<<"source: "<<_qsetsettings.fileName()<<" dest: "<<_qspath+"/"+_qsname <<" Res: "<<_bres;
    To copy to clipboard, switch view to plain text mode 

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

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: extra hard copy (as text) of QSettings

    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.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. #6
    Join Date
    Oct 2009
    Posts
    90
    Thanks
    4
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: extra hard copy (as text) of QSettings

    to copy keys one by one yourself
    excellent man!

Similar Threads

  1. Unhandled exception in qatomic
    By NewGuy in forum Qt Programming
    Replies: 14
    Last Post: 23rd July 2013, 09:49
  2. Problem with copy text to clipboard
    By weiching in forum Qt Programming
    Replies: 1
    Last Post: 22nd December 2008, 12:44

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.