QcCharacterPresets Class
The presets of the character screen (decision E-231): the built-in ones, translated, followed by the player's own (at most QcCharacterProfile::maxPresets). More...
| Header: | #include <clientcore/settings/QcCharacterPresets.h> |
| Inherits: | QObject |
Public Functions
| std::optional<QcAppearance> | appearance(int row) const |
| bool | canSave() const |
| bool | canSaveAs(const QString &name) const |
| void | load(const QList<QcCharacterPreset> &presets) |
| void | remove(int row) |
| QVariantList | rows() const |
| bool | save(const QString &name, const QcAppearance &look) |
| const QList<QcCharacterPreset> & | saved() const |
Reimplemented Public Functions
| virtual bool | eventFilter(QObject *watched, QEvent *event) override |
Signals
| void | changed() |
Detailed Description
Rows count across both. The labels follow the UI language: changed is also emitted when a translator is installed or removed.
Member Function Documentation
std::optional<QcAppearance> QcCharacterPresets::appearance(int row) const
Returns the look of row; none for a row that does not exist.
bool QcCharacterPresets::canSave() const
Returns whether there is a free place for another preset of the player.
bool QcCharacterPresets::canSaveAs(const QString &name) const
Returns whether save(name) would succeed: a usable name and a free place or a preset of that name to replace.
[signal] void QcCharacterPresets::changed()
The rows changed: a preset saved, removed or loaded, or the UI language changed.
[override virtual] bool QcCharacterPresets::eventFilter(QObject *watched, QEvent *event)
Reimplements: QObject::eventFilter(QObject *watched, QEvent *event).
void QcCharacterPresets::load(const QList<QcCharacterPreset> &presets)
Takes the player's own presets from the settings (at most QcCharacterProfile::maxPresets).
void QcCharacterPresets::remove(int row)
Removes the preset of the player in row; built-in ones stay.
QVariantList QcCharacterPresets::rows() const
Returns the rows for QML: [{label, builtIn, look}], look as QcCharacterProfile::lookMap.
bool QcCharacterPresets::save(const QString &name, const QcAppearance &look)
Saves look as the player's preset name (cleaned; replacing one of that name). Returns false when canSaveAs() refuses.
const QList<QcCharacterPreset> &QcCharacterPresets::saved() const
Returns the player's own presets.