• MonitorListModel
  • MonitorListModel Class

    class ScreenPlay::MonitorListModel

    MonitorListModel. More...

    Header: #include <MonitorListModel>

    Public Functions

    MonitorListModel(QObject *parent = nullptr)
    int getAppIDByMonitorIndex(const int) const
    void setWallpaperActiveMonitor(const std::shared_ptr<ScreenPlayWallpaper> &wallpaper, const QVector<int> monitors)

    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 clearActiveWallpaper()
    void closeWallpaper(const QString &appID)
    void reset()

    Detailed Description

    Loads all available monitors and saves them in a QAbstractListModel inherited list model. This list model gets updated if:

    This listmodel is also needed for calculating the monitor preview in the UI.

    Member Function Documentation

    MonitorListModel::MonitorListModel(QObject *parent = nullptr)

    Constructor.

    [slot] void MonitorListModel::clearActiveWallpaper()

    Clears the listmodel.

    [slot] void MonitorListModel::closeWallpaper(const QString &appID)

    Removes the preview image and appID inside an monitor item.

    [slot] void MonitorListModel::reset()

    Removes all items and loads them vida loadMonitors() again.

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

    Retruns the data member of the Monitor.

    int MonitorListModel::getAppIDByMonitorIndex(const int) const

    If successful this function returns an AppID. Otherwhise std::nullopt.

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

    Returns the variable names for QML.

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

    Returns the amount of active monitors.

    void MonitorListModel::setWallpaperActiveMonitor(const std::shared_ptr<ScreenPlayWallpaper> &wallpaper, const QVector<int> monitors)

    Sets the previewImage and appID for a list item.