Results 1 to 9 of 9

Thread: QSettings dont save updated variables by QML

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2019
    Posts
    12
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default QSettings dont save updated variables by QML

    Hello, I have an app where user can change a variables - delays, hotkeys etc. I do the "config saver" but it recieve "old" (not updated) variables. "Variable check" in same class working, but in other class shows others.

    Qt Code:
    1. void Building::setWindowName(QString value){
    2. connect(this, SIGNAL (textChanged(QString)), this, SLOT(setWindowName(QString)));
    3. sett.windowName = value;
    4. sett.windowID = (const wchar_t*) sett.windowName.utf16();
    5. qDebug() << "windowName " << sett.windowName; //Shows updated
    6. }
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. class Settings : public QObject
    2. {
    3. Q_OBJECT
    4.  
    5. public:
    6. explicit Settings(QObject *parent = nullptr);
    7. QSettings* sett;
    8.  
    9. int toggleButton=0x52;
    10. int btoggleButton=0x52;// r
    11. int inventoryKey=0x45; // e
    12. int minCpsDelay = 10;
    13. int maxCpsDelay = 15;
    14.  
    15. QString windowName = "Minecraft 1.8.8 (Blazingpack.pl)";
    16. LPCWSTR windowID = (const wchar_t*) windowName.utf16();
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. void Settings::clickcheck()
    2. {
    3. qDebug() << windowName; //Showed old - not updated variable.
    4. }
    To copy to clipboard, switch view to plain text mode 


    I just want to save some data from different classes.
    Last edited by Bedopies; 12th May 2019 at 00:22.

Similar Threads

  1. Where to save QSettings?
    By arcull in forum Newbie
    Replies: 5
    Last Post: 23rd July 2015, 17:43
  2. Replies: 4
    Last Post: 5th October 2010, 22:47
  3. Save/Load variables to FIle
    By Jordan in forum Qt Programming
    Replies: 2
    Last Post: 26th May 2010, 11:35
  4. QSettings does not save...
    By mtrpoland in forum Qt Programming
    Replies: 2
    Last Post: 28th August 2007, 12:15

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.