void Main::testsetting()
{
if(mysetting->value("testvalue").toString()==testvalue)
{ //second run
QMessageBox::information(this,
"Check",
"Testvalue="+testvalue
+ " is equal="+mysetting
->value
("testvalue").
toString(),
QMessageBox::Ok);
}
else
{ //first run
QMessageBox::information(this,
"Check",
"Testvalue="+testvalue
+ " isn't equal="+mysetting
->value
("testvalue").
toString(),
QMessageBox::Ok);
}
mysetting->setValue("testvalue",testvalue);
mysetting->sync();
delete mysetting;
}
void Main::testsetting()
{
mysetting=new QSettings("test.ini",QSettings::IniFormat);
if(mysetting->value("testvalue").toString()==testvalue)
{ //second run
QMessageBox::information(this,"Check","Testvalue="+testvalue+ " is equal="+mysetting->value("testvalue").toString(),QMessageBox::Ok);
}
else
{ //first run
QMessageBox::information(this,"Check","Testvalue="+testvalue+ " isn't equal="+mysetting->value("testvalue").toString(),QMessageBox::Ok);
}
mysetting->setValue("testvalue",testvalue);
mysetting->sync();
if(mysetting->status() ==QSettings::NoError) QMessageBox::information(this,"Save","Save successful",QMessageBox::Ok);
else QMessageBox::information(this,"Save","Save error",QMessageBox::Ok);
delete mysetting;
}
To copy to clipboard, switch view to plain text mode
Bookmarks