• MonitorListModel
  • MonitorListModel Class

    class ScreenPlay::MonitorListModel

    MonitorListModel. More...

    Header: #include <MonitorListModel>

    Public Functions

    MonitorListModel(QObject *parent = nullptr)
    std::optional<QString> getAppIDByMonitorIndex(const int index) const
    void setWallpaperMonitor(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)
    QRect getAbsoluteDesktopSize() const
    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] QRect MonitorListModel::getAbsoluteDesktopSize() const

    MonitorListModel::getAbsoluteDesktopSize \return

    [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.

    std::optional<QString> MonitorListModel::getAppIDByMonitorIndex(const int index) 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::setWallpaperMonitor(const std::shared_ptr<ScreenPlayWallpaper> &wallpaper, const QVector<int> monitors)

    Sets a shared_ptr to the monitor list. This should be used to set and remove the shared_ptr.