Results 1 to 3 of 3

Thread: Problem with converting a QSettings value to QString

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2011
    Posts
    3
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Problem with converting a QSettings value to QString

    This is my code:
    Qt Code:
    1. fileName = QFileDialog::getOpenFileName(this, tr("Open Image File"), QDir::currentPath());//QString
    2. settings = new QSettings("Something", "Some Thing");//QSettings
    3. settings->setValue("lastimage", fileName);
    To copy to clipboard, switch view to plain text mode 

    The value appears in the Windows registry as it should be, but when i try to convert it back to QString it returns an empty string (the value field in the registry key is empty).
    Is there something wrong with this code:

    Qt Code:
    1. fileName = settings->value("lastimage").toString();
    To copy to clipboard, switch view to plain text mode 

    or do I have to do something else ?
    Last edited by high_flyer; 27th April 2011 at 08:27. Reason: code tags

Similar Threads

  1. converting uint to QString
    By Yayati.Ekbote in forum Newbie
    Replies: 1
    Last Post: 14th April 2010, 13:43
  2. Converting a QString to a LPCTSTR?
    By dobedidoo in forum Qt Programming
    Replies: 3
    Last Post: 7th December 2009, 14:27
  3. Problem in converting QString to QChar array?
    By KaKa in forum Qt Programming
    Replies: 2
    Last Post: 19th March 2007, 00:38
  4. Converting u_char to QString
    By merlvingian in forum Newbie
    Replies: 7
    Last Post: 29th September 2006, 00:11
  5. QString to char* not converting
    By DPinLV in forum Qt Programming
    Replies: 17
    Last Post: 6th August 2006, 12:15

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.