Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Toutes les fonctions  ·  Vues d'ensemble  · 

Qt 3 Support Members for QSettings

The following class members are part of the Qt 3 support layer. They are provided to help you port old code to Qt 4. We advise against using them in new code.

Public Types

enum System { Unix, Windows, Mac }

Public Functions

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 )
  • 8 public functions inherited from QObject

Member Type Documentation

enum QSettings::System

ConstantValueDescription
QSettings::Unix0Unix systems (X11 and Embedded Linux)
QSettings::Windows1Microsoft Windows systems
QSettings::Mac2Mac OS X systems

See also insertSearchPath() and removeSearchPath().

Member Function Documentation

QStringList QSettings::entryList ( const QString & key ) const

Returns a list of all sub-keys of key.

Use childKeys() instead.

For example, if you have code like

 QSettings settings;
 QStringList keys = settings.entryList("cities");
 ...

you can rewrite it as

 QSettings settings;
 settings.beginGroup("cities");
 QStringList keys = settings.childKeys();
 ...
 settings.endGroup();

void QSettings::insertSearchPath ( System system, const QString & path )

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".

bool QSettings::readBoolEntry ( const QString & key, bool defaultValue = false, bool * ok = 0 )

Returns the value for setting key converted to a bool. If the setting doesn't exist, returns defaultValue.

If ok is not 0, *ok is set to true if the key exists, otherwise *ok is set to false.

Use value() instead.

For example, if you have code like

 bool ok;
 bool grid = settings.readBoolEntry("showGrid", true, &ok);

you can rewrite it as

 bool ok = settings.contains("showGrid");
 bool grid = settings.value("showGrid", true).toBool();

double QSettings::readDoubleEntry ( const QString & key, double defaultValue = 0, bool * ok = 0 )

Returns the value for setting key converted to a double. If the setting doesn't exist, returns defaultValue.

If ok is not 0, *ok is set to true if the key exists, otherwise *ok is set to false.

Use value() instead.

For example, if you have code like

 bool ok;
 double pi = settings.readDoubleEntry("pi", 3.141592, &ok);

you can rewrite it as

 bool ok = settings.contains("pi");
 double pi = settings.value("pi", 3.141592).toDouble();

QString QSettings::readEntry ( const QString & key, const QString & defaultValue = QString(), bool * ok = 0 )

Returns the value for setting key converted to a QString. If the setting doesn't exist, returns defaultValue.

If ok is not 0, *ok is set to true if the key exists, otherwise *ok is set to false.

Use value() instead.

For example, if you have code like

 bool ok;
 QString str = settings.readEntry("userName", "administrator", &ok);

you can rewrite it as

 bool ok = settings.contains("userName");
 QString str = settings.value("userName", "administrator").toString();

QStringList QSettings::readListEntry ( const QString & key, bool * ok = 0 )

Returns the value of setting key converted to a QStringList.

If ok is not 0, *ok is set to true if the key exists, otherwise *ok is set to false.

Use value() instead.

For example, if you have code like

 bool ok;
 QStringList list = settings.readListEntry("recentFiles", &ok);

you can rewrite it as

 bool ok = settings.contains("recentFiles");
 QStringList list = settings.value("recentFiles").toStringList();

QStringList QSettings::readListEntry ( const QString & key, QChar separator, bool * ok = 0 )

Returns the value of setting key converted to a QStringList. separator is ignored.

If ok is not 0, *ok is set to true if the key exists, otherwise *ok is set to false.

Use value() instead.

For example, if you have code like

 bool ok;
 QStringList list = settings.readListEntry("recentFiles", ":", &ok);

you can rewrite it as

 bool ok = settings.contains("recentFiles");
 QStringList list = settings.value("recentFiles").toStringList();

int QSettings::readNumEntry ( const QString & key, int defaultValue = 0, bool * ok = 0 )

Returns the value for setting key converted to an int. If the setting doesn't exist, returns defaultValue.

If ok is not 0, *ok is set to true if the key exists, otherwise *ok is set to false.

Use value() instead.

For example, if you have code like

 bool ok;
 int max = settings.readNumEntry("maxConnections", 30, &ok);

you can rewrite it as

 bool ok = settings.contains("maxConnections");
 int max = settings.value("maxConnections", 30).toInt();

bool QSettings::removeEntry ( const QString & key )

Use remove() instead.

void QSettings::removeSearchPath ( System system, const QString & path )

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".

void QSettings::resetGroup ()

Sets the current group to be the empty string.

Use endGroup() instead (possibly multiple times).

For example, if you have code like

 QSettings settings;
 settings.beginGroup("mainWindow");
 settings.beginGroup("leftPanel");
 ...
 settings.resetGroup();

you can rewrite it as

 QSettings settings;
 settings.beginGroup("mainWindow");
 settings.beginGroup("leftPanel");
 ...
 settings.endGroup();
 settings.endGroup();

void QSettings::setPath ( const QString & organization, const QString & application, Scope scope = Global )

Specifies the organization, application, and scope to use by the QSettings object.

Use the appropriate constructor instead, with QSettings::UserScope instead of QSettings::User and QSettings::SystemScope instead of QSettings::Global.

For example, if you have code like

 QSettings settings;
 settings.setPath("twikimaster.com", "Kanooth", QSettings::Global);

you can rewrite it as

 QSettings settings(QSettings::SystemScope, "twikimaster.com", "Kanooth");

QStringList QSettings::subkeyList ( const QString & key ) const

Returns a list of all sub-keys of key.

Use childGroups() instead.

For example, if you have code like

 QSettings settings;
 QStringList groups = settings.entryList("cities");
 ...

you can rewrite it as

 QSettings settings;
 settings.beginGroup("cities");
 QStringList groups = settings.childKeys();
 ...
 settings.endGroup();

bool QSettings::writeEntry ( const QString & key, bool value )

Sets the value of setting key to value.

Use setValue() instead.

bool QSettings::writeEntry ( const QString & key, double value )

This is an overloaded function.

bool QSettings::writeEntry ( const QString & key, int value )

This is an overloaded function.

bool QSettings::writeEntry ( const QString & key, const char * value )

This is an overloaded function.

bool QSettings::writeEntry ( const QString & key, const QString & value )

This is an overloaded function.

bool QSettings::writeEntry ( const QString & key, const QStringList & value )

This is an overloaded function.

bool QSettings::writeEntry ( const QString & key, const QStringList & value, QChar separator )

This is an overloaded function.

Use setValue(key, value) instead. You don't need separator.

Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 94
  2. Apercevoir la troisième dimension ou l'utilisation multithreadée d'OpenGL dans Qt, un article des Qt Quarterly traduit par Guillaume Belz 0
  3. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  4. Pourquoi les programmeurs sont-ils moins payés que les gestionnaires de programmes ? Manquent-ils de pouvoir de négociation ? 42
  5. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  6. 2017 : un quinquennat pour une nouvelle version du C++ ? Possible, selon Herb Sutter 9
  7. Qt Commercial : Digia organise un webinar gratuit le 27 mars sur la conception d'interfaces utilisateur et d'applications avec le framework 0
Page suivante

Le blog Digia au hasard

Logo

Une nouvelle ère d'IHM 3D pour les automobiles

Le blog Digia est l'endroit privilégié pour la communication sur l'édition commerciale de Qt, où des réponses publiques sont apportées aux questions les plus posées au support. Lire l'article.

Communauté

Ressources

Liens utiles

Contact

  • Vous souhaitez rejoindre la rédaction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

Qt dans le magazine

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 4.7
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web