Results 1 to 4 of 4

Thread: Settings problem

  1. #1
    Join Date
    May 2009
    Location
    USA
    Posts
    300
    Thanks
    82
    Thanked 11 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Settings problem

    When this:

    QFont font = settings.value("MainWindow/Font").value<QFont>();

    Returns a valid font value,
    why doesn't this:

    QColor color = settings.value("MainWindow/Color").value<QColor>();

    Return a valid color value?

  2. #2
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Settings problem

    Just a guess here, but the default constructor for QFont returns a valid font (the applications default font), whereas the default constructor for QColor initialises to an invalid color.

  3. #3
    Join Date
    May 2009
    Location
    USA
    Posts
    300
    Thanks
    82
    Thanked 11 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Settings problem

    Possible, but the example in the QSettings doc is:

    QColor color = settings.value("DataPump/bgcolor").value<QColor>();

  4. #4
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Settings problem

    If the key doesn't exist, your still left with the default though.

Similar Threads

  1. How to set Proxy settings in Qt
    By Qt Coder in forum Qt Programming
    Replies: 1
    Last Post: 6th August 2009, 08:52
  2. .pro settings for obj subdir
    By bajarangi in forum Newbie
    Replies: 2
    Last Post: 17th April 2009, 15:31
  3. Saving settings to XML
    By arturo182 in forum Qt Programming
    Replies: 2
    Last Post: 8th March 2009, 12:10
  4. KPart settings?
    By maartenS in forum KDE Forum
    Replies: 1
    Last Post: 26th November 2008, 09:43
  5. qSplitter settings
    By ovidiu.sabou in forum Qt Tools
    Replies: 4
    Last Post: 14th March 2006, 19:24

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.