• ProjectSettingsListModel
  • ProjectSettingsListModel Class

    class ScreenPlay::ProjectSettingsListModel

    ProjectSettingsListModel used for the dynamic loading of the properties json object inside a project.json. More...

    Header: #include <ProjectSettingsListModel>

    Public Functions

    void append(const ScreenPlay::SettingsItem &&item)
    QJsonObject getActiveSettingsJson()

    Reimplemented Public Functions

    virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override
    virtual QHash<int, QByteArray> roleNames() const override
    virtual int rowCount(const QModelIndex &parent = QModelIndex()) const override

    Public Slots

    void setValueAtIndex(const int row, const QString &key, const QJsonObject &value)

    Detailed Description

    The loaded properties are allowed to have one level of nesting to simulate headlines:

    "properties": {
        "Attractor": {
            "attStrength": {
                "from": 0,
                "stepSize": 100,
                "to": 100000,
                "type": "slider",
                "value": 8000000
            }
        },
        "Emitter": {
            "emitRate": {
                "from": 0,
                "stepSize": 1,
                "to": 2500,
                "type": "slider",
                "value": 25
            }
        }
    }

    In this example the Attractor and Emitter would be a headline. In the UI we then displays it for the user to modify. Otherwhise it is a regular QAbstractListModel based list model.

    Member Function Documentation

    [slot] void ProjectSettingsListModel::setValueAtIndex(const int row, const QString &key, const QJsonObject &value)

    .

    void ProjectSettingsListModel::append(const ScreenPlay::SettingsItem &&item)

    appends an SettingsItem.

    [override virtual] QVariant ProjectSettingsListModel::data(const QModelIndex &index, int role = Qt::DisplayRole) const

    .

    QJsonObject ProjectSettingsListModel::getActiveSettingsJson()

    ProjectSettingsListModel::getActiveSettingsJson

    [override virtual] QHash<int, QByteArray> ProjectSettingsListModel::roleNames() const

    .

    [override virtual] int ProjectSettingsListModel::rowCount(const QModelIndex &parent = QModelIndex()) const

    .