Qt and Symbian settings management comparison

From Qt Wiki
Jump to navigation Jump to search

Template:ArticleMetaData

Overview[edit | edit source]

This article provides a comparison of settings management between Symbian OS and Qt. Sample code for creating, setting, and getting settings values is also given below.


Description[edit | edit source]

Settings are stored in form of key/value pairs in both Symbian and Qt. However, there are differences in the paths where the settings files are stored in Symbian OS and Qt.

Operations S60/Symbian OS Qt
Settings mechanism Central Repository Conf file
Key creation Settings (keys) are predefined through xls or confml. A default value is assigned to them. Settings (keys) are created dynamically from the application and stored in the .conf file.
Storage format of settings file Platform creates a .cre file where the values set by the application are stored/restored. The .cre file is not in human readable format. No .cre file generated. Directly stored in human readable .conf file.
Organisation of settings keys No hierarchy of settings. There is a hierarchy that can be maintained in keys. For example, all settings pertaining to UI can be put as subkeys under the main UI key.
Accessing settings that are stored in platform-specific format Possible to access platform/other application settings because all are in .cre format. Possible to access keys/values stored in central repository through extension classes such as 76ytuiytuityutyutututyutyutyu.
Class 76ytuiytuityutyutututyutyutyu 76ytuiytuityutyutututyutyutyu
Creating instance of setting class 76ytuiytuityutyutututyutyutyu 76ytuiytuityutyutututyutyutyu A directory is created which has 76ytuiytuityutyutututyutyutyu and a conf file is created in the directory with 76ytuiytuityutyutututyutyutyu.
Setting a value 76ytuiytuityutyutututyutyutyu 76ytuiytuityutyutututyutyutyu
Getting a value 76ytuiytuityutyutututyutyutyu QSettings::value
Notifications for change in settings Possible through class 76ytuiytuityutyutututyutyutyu. No direct class to monitor changes in values of 76ytuiytuityutyutututyutyutyu keys. Possible to monitor cenrep key changes through 76ytuiytuityutyutututyutyutyu and their associated classes.


Solution[edit | edit source]

In a Qt application you can use either 76ytuiytuityutyutututyutyutyu or continue to use 76ytuiytuityutyutututyutyutyu (through the 76ytuiytuityutyutututyutyutyu class or preferably Mobile Extensions Archived:Mobile Extensions#13. Settings Manager API). The 76ytuiytuityutyutututyutyutyu class provides persistent platform-independent platform settings.

The following example illustrates the creation of settings in Qt.


MyApplication::MyApplication(QWidget *parent)
   : QWidget(parent) 
{
//The company name and application name need to be passed as a parameter.
//The path of storing the settings is based on these input parameters
QSettings setting(“Company", "MyApplication");
//Setting an int value
QVariant value = 10; //or we can also assign int value  = 10 
setting.setValue("Engine/TimeOutPeriod", value);
//Setting a string value
QString string (“This is sample”); //or we can also assign QVariant string(“This is sample”)
setting.setValue(“Engine/MessageTitle”, string);
//Getting an int value;
int settingval =  setting.value("Engine/TimeOutPeriod ").toInt();
//Getting a string value
QString title = setting.value("Engine/MessageTitle ").toString();
}



zh-hans:Qt和S60环境设置管理比较