Details
-
Bug
-
Resolution: Out of scope
-
P3: Somewhat important
-
4.4.0
-
None
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;
}
------------------------------------------------------------------------