KCoreConfigSkeleton::ItemEnum Class

class KCoreConfigSkeleton::ItemEnum

Class for handling enums. More...

Public Types

struct Choice

Public Functions

ItemEnum(const QString &_group, const QString &_key, qint32 &reference, const QList<KCoreConfigSkeleton::ItemEnum::Choice> &choices, qint32 defaultValue = 0)
QList<KCoreConfigSkeleton::ItemEnum::Choice> choices() const
void setValueForChoice(const QString &name, const QString &valueForChoice)
QString valueForChoice(const QString &name) const

Detailed Description

Enums specified with KConfigXT should be mapped to enums in the C++ codebase, as the generated getter for the ItemEnum will return an int.

See also Using KConfig XT and Choice.

Member Function Documentation

ItemEnum::ItemEnum(const QString &_group, const QString &_key, qint32 &reference, const QList<KCoreConfigSkeleton::ItemEnum::Choice> &choices, qint32 defaultValue = 0)

Constructs an enum item with the given _group, _key, the initial value reference to hold in the item, the list of enum choices, and the defaultValue for the item.

QList<KCoreConfigSkeleton::ItemEnum::Choice> ItemEnum::choices() const

Specifies a list of enum choices.

The name given to the choices list should match an equivalent enum in your C++ codebase, including the namespace. For example:

<choices name="KWin::Layer">

Each individual choice in the XML file should then be mapped to the same C++ code enum values in the same order.

void ItemEnum::setValueForChoice(const QString &name, const QString &valueForChoice)

Stores a choice value valueForChoice for an enum entry with the given name.

See also valueForChoice().

QString ItemEnum::valueForChoice(const QString &name) const

Returns the value for the choice with the given name.

See also setValueForChoice().