以下成員源於類 QSettings are part of the Qt compatibility layer. We advise against using them in new code.
| enum | 係統 { Unix, Windows, Mac } |
| QStringList | entryList (const QString & key ) const |
| void | insertSearchPath (System system , const QString & path ) |
| bool | readBoolEntry (const QString & key , bool defaultValue = false, bool * ok = 0) |
| double | readDoubleEntry (const QString & key , double defaultValue = 0, bool * ok = 0) |
| QString | readEntry (const QString & key , const QString & defaultValue = QString(), bool * ok = 0) |
| QStringList | readListEntry (const QString & key , bool * ok = 0) |
| QStringList | readListEntry (const QString & key , QChar separator , bool * ok = 0) |
| int | readNumEntry (const QString & key , int defaultValue = 0, bool * ok = 0) |
| bool | removeEntry (const QString & key ) |
| void | removeSearchPath (System system , const QString & path ) |
| void | resetGroup () |
| void | setPath (const QString & organization , const QString & application , Scope scope = Global) |
| QStringList | subkeyList (const QString & key ) const |
| bool | writeEntry (const QString & key , bool value ) |
| bool | writeEntry (const QString & key , double value ) |
| bool | writeEntry (const QString & key , int value ) |
| bool | writeEntry (const QString & key , const char * value ) |
| bool | writeEntry (const QString & key , const QString & value ) |
| bool | writeEntry (const QString & key , const QStringList & value ) |
| bool | writeEntry (const QString & key , const QStringList & value , QChar separator ) |
| 常量 | 值 | 描述 |
|---|---|---|
QSettings::Unix
|
0
|
Unix systems (X11 and Embedded Linux) |
QSettings::Windows
|
1
|
Microsoft Windows systems |
QSettings::Mac
|
2
|
Mac OS X systems |
另請參閱 insertSearchPath () 和 removeSearchPath ().
Returns a list of all sub-keys of key .
使用 childKeys () 代替。
例如,若有代碼像
QSettings settings;
QStringList keys = settings.entryList("cities");
...
可以把它重寫成
QSettings settings; settings.beginGroup("cities"); QStringList keys = settings.childKeys(); ... settings.endGroup();
This function is implemented as a no-op. It is provided for source compatibility with Qt 3. The new QSettings class has no concept of "search path".
返迴值為設置
key
converted to a
bool
。若設置不存在,返迴
defaultValue
.
若 ok is not 0, * ok is set to true if the key exists, otherwise * ok 被設為 false。
使用 value () 代替。
例如,若有代碼像
bool ok;
bool grid = settings.readBoolEntry("showGrid", true, &ok);
可以把它重寫成
bool ok = settings.contains("showGrid"); bool grid = settings.value("showGrid", true).toBool();
返迴值為設置
key
converted to a
double
。若設置不存在,返迴
defaultValue
.
若 ok is not 0, * ok is set to true if the key exists, otherwise * ok 被設為 false。
使用 value () 代替。
例如,若有代碼像
bool ok;
double pi = settings.readDoubleEntry("pi", 3.141592, &ok);
可以把它重寫成
bool ok = settings.contains("pi"); double pi = settings.value("pi", 3.141592).toDouble();
返迴值為設置 key converted to a QString 。若設置不存在,返迴 defaultValue .
若 ok is not 0, * ok is set to true if the key exists, otherwise * ok 被設為 false。
使用 value () 代替。
例如,若有代碼像
bool ok;
QString str = settings.readEntry("userName", "administrator", &ok);
可以把它重寫成
bool ok = settings.contains("userName"); QString str = settings.value("userName", "administrator").toString();
Returns the value of setting key converted to a QStringList .
若 ok is not 0, * ok is set to true if the key exists, otherwise * ok 被設為 false。
使用 value () 代替。
例如,若有代碼像
bool ok;
QStringList list = settings.readListEntry("recentFiles", &ok);
可以把它重寫成
bool ok = settings.contains("recentFiles"); QStringList list = settings.value("recentFiles").toStringList();
Returns the value of setting key converted to a QStringList . separator 被忽略。
若 ok is not 0, * ok is set to true if the key exists, otherwise * ok 被設為 false。
使用 value () 代替。
例如,若有代碼像
bool ok;
QStringList list = settings.readListEntry("recentFiles", ":", &ok);
可以把它重寫成
bool ok = settings.contains("recentFiles"); QStringList list = settings.value("recentFiles").toStringList();
返迴值為設置
key
converted to an
int
。若設置不存在,返迴
defaultValue
.
若 ok is not 0, * ok is set to true if the key exists, otherwise * ok 被設為 false。
使用 value () 代替。
例如,若有代碼像
bool ok;
int max = settings.readNumEntry("maxConnections", 30, &ok);
可以把它重寫成
bool ok = settings.contains("maxConnections"); int max = settings.value("maxConnections", 30).toInt();
使用 remove () 代替。
This function is implemented as a no-op. It is provided for source compatibility with Qt 3. The new QSettings class has no concept of "search path".
Sets the current group to be the empty string.
使用 endGroup () instead (possibly multiple times).
例如,若有代碼像
QSettings settings;
settings.beginGroup("mainWindow");
settings.beginGroup("leftPanel");
...
settings.resetGroup();
可以把它重寫成
QSettings settings; settings.beginGroup("mainWindow"); settings.beginGroup("leftPanel"); ... settings.endGroup(); settings.endGroup();
Specifies the organization , application ,和 scope to use by the QSettings 對象。
Use the appropriate constructor instead, with QSettings::UserScope 而不是 QSettings::User and QSettings::SystemScope 而不是 QSettings::Global .
例如,若有代碼像
QSettings settings;
settings.setPath("twikimaster.com", "Kanooth", QSettings::Global);
可以把它重寫成
QSettings settings(QSettings::SystemScope, "twikimaster.com", "Kanooth");
Returns a list of all sub-keys of key .
使用 childGroups () 代替。
例如,若有代碼像
QSettings settings;
QStringList groups = settings.entryList("cities");
...
可以把它重寫成
QSettings settings; settings.beginGroup("cities"); QStringList groups = settings.childKeys(); ... settings.endGroup();
設置值為設置 key to value .
使用 setValue () 代替。
這是重載函數。
這是重載函數。
這是重載函數。
這是重載函數。
這是重載函數。
這是重載函數。
使用 setValue ( key , value ) instead. You don't need separator .