Logo Search packages:      
Sourcecode: qt4-x11 version File versions

QSettings Class Reference

Inheritance diagram for QSettings:


List of all members.

Detailed Description

The QSettings class provides persistent platform-independent application settings.

Users normally expect an application to remember its settings (window sizes and positions, options, etc.) across sessions. This information is often stored in the system registry on Windows, and in XML preferences files on Mac OS X. On Unix systems, in the absence of a standard, many applications (including the KDE applications) use INI text files.

QSettings is an abstraction around these technologies, enabling you to save and restore application settings in a portable manner. It also supports {registerFormat()}{custom storage formats}.

QSettings's API is based on QVariant, allowing you to save most value-based types, such as QString, QRect, and QImage, with the minimum of effort.

If all you need is a non-persistent memory-based structure, consider using QMap<QString, QVariant> instead.


Definition at line 75 of file qsettings.h.

Public Types

enum  Format {
  NativeFormat, IniFormat, InvalidFormat = 16, CustomFormat1,
  CustomFormat2, CustomFormat3, CustomFormat4, CustomFormat5,
  CustomFormat6, CustomFormat7, CustomFormat8, CustomFormat9,
  CustomFormat10, CustomFormat11, CustomFormat12, CustomFormat13,
  CustomFormat14, CustomFormat15, CustomFormat16
typedef bool(* ReadFunc )(QIODevice &device, SettingsMap &map)
enum  Scope { UserScope, SystemScope }
typedef QMap< QString, QVariantSettingsMap
enum  Status { NoError = 0, AccessError, FormatError }
typedef bool(* WriteFunc )(QIODevice &device, const SettingsMap &map)

Public Slots

void deleteLater ()


void destroyed (QObject *=0)

Public Member Functions

QStringList allKeys () const
QString applicationName () const
void beginGroup (const QString &prefix)
int beginReadArray (const QString &prefix)
void beginWriteArray (const QString &prefix, int size=-1)
bool blockSignals (bool b)
QStringList childGroups () const
QStringList childKeys () const
const QObjectListchildren () const
void clear ()
bool connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const
bool contains (const QString &key) const
bool disconnect (const QObject *receiver, const char *member=0)
bool disconnect (const char *signal=0, const QObject *receiver=0, const char *member=0)
void dumpObjectInfo ()
void dumpObjectTree ()
QList< QByteArraydynamicPropertyNames () const
void endArray ()
void endGroup ()
virtual bool eventFilter (QObject *, QEvent *)
bool fallbacksEnabled () const
QString fileName () const
template<typename T>
findChild (const QString &aName=QString()) const
template<typename T>
QList< T > findChildren (const QRegExp &re) const
template<typename T>
QList< T > findChildren (const QString &aName=QString()) const
Format format () const
QString group () const
bool inherits (const char *classname) const
void installEventFilter (QObject *)
bool isWidgetType () const
bool isWritable () const
void killTimer (int id)
void moveToThread (QThread *thread)
QString objectName () const
QString organizationName () const
QObjectparent () const
QVariant property (const char *name) const
 QSettings (QObject *parent=0)
 QSettings (const QString &fileName, Format format, QObject *parent=0)
 QSettings (Format format, Scope scope, const QString &organization, const QString &application=QString(), QObject *parent=0)
 QSettings (Scope scope, const QString &organization, const QString &application=QString(), QObject *parent=0)
 QSettings (const QString &organization, const QString &application=QString(), QObject *parent=0)
void remove (const QString &key)
void removeEventFilter (QObject *)
Scope scope () const
void setArrayIndex (int i)
void setFallbacksEnabled (bool b)
void setObjectName (const QString &name)
void setParent (QObject *)
bool setProperty (const char *name, const QVariant &value)
void setUserData (uint id, QObjectUserData *data)
void setValue (const QString &key, const QVariant &value)
bool signalsBlocked () const
int startTimer (int interval)
Status status () const
void sync ()
QThreadthread () const
QObjectUserData * userData (uint id) const
QVariant value (const QString &key, const QVariant &defaultValue=QVariant()) const
 ~QSettings ()

Static Public Member Functions

static bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
static Format defaultFormat ()
static bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
static Format registerFormat (const QString &extension, ReadFunc readFunc, WriteFunc writeFunc, Qt::CaseSensitivity caseSensitivity=Qt::CaseSensitive)
static uint registerUserData ()
static void setDefaultFormat (Format format)
static void setPath (Format format, Scope scope, const QString &path)
static void setSystemIniPath (const QString &dir)
static void setUserIniPath (const QString &dir)

Protected Member Functions

virtual void childEvent (QChildEvent *)
virtual void connectNotify (const char *signal)
virtual void customEvent (QEvent *)
virtual void disconnectNotify (const char *signal)
bool event (QEvent *event)
int receivers (const char *signal) const
QObjectsender () const
virtual void timerEvent (QTimerEvent *)

Protected Attributes

QObjectData * d_ptr

Static Protected Attributes

static const QMetaObject staticQtMetaObject


QString objectName
 the name of this object


class QApplication
class QApplicationPrivate
class QCoreApplication
class QCoreApplicationPrivate
struct QMetaObject
class QThreadData
class QWidget

Related Functions

(Note that these are not member functions.)

qFindChild (const QObject *obj, const QString &name=QString(), T dummy=0)
qFindChild (const QObject *obj, const QString &name)
QList< T > qFindChildren (const QObject *obj, const QString &name=QString(), T dummy=0)
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
QList< T > qFindChildren (const QObject *obj, const QString &name)
T * qobject_cast (QObject *object)
void * qt_find_obj_child (QObject *parent, const char *type, const QString &name)

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index