Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-2265

QSettings incorrect recovering of values with SystemScope

    XMLWordPrintable

Details

    Description

      The output of the code below is:
      foo/bar false
      onescope: true

      It should be:
      foo/bar true
      onescope: true

      ------------------------------------------------------------------------
      #include <QtGui>

      #define ORG "org"
      #define APP "app"
      #define VAL1 "foo/bar"
      #define VAL2 "one/is"

      void foo()
      {
      QSettings settings( QSettings::SystemScope, ORG, APP );
      settings.setValue( VAL1, true );
      }

      void bar()
      {
      QSettings settings2;
      bool value = settings2.value( VAL1 ).toBool();
      qDebug() << VAL1 << value;
      }

      void onescope()
      {
      QSettings settings( QSettings::SystemScope, ORG, APP );
      settings.setValue( VAL2, true );
      QSettings settings2;
      bool value = settings2.value( VAL2 ).toBool();
      qDebug() << "onescope:" << value;
      }

      int main( int argc, char * argv[] )
      {
      QApplication app( argc, argv );
      QCoreApplication::setOrganizationName( ORG );
      QCoreApplication::setApplicationName( APP );
      foo();
      bar();
      onescope();
      return 0;
      }
      ------------------------------------------------------------------------

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            stormols Marius Storm-Olsen
            admin Administrator
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes