#ifndef OMOBIDISPLAYTEXTMODEL_H #define OMOBIDISPLAYTEXTMODEL_H #include #include #include #include class OmobiDisplayTextModel : public QAbstractListModel { Q_OBJECT public: friend class OmobiDisplayBackend; enum OmobiDisplayTextModelRole { TextRole = Qt::DisplayRole, ActiveRole, RuntimeRole, ColorRole, AlignmentRole, ScrollRole, ScrollSpeedRole, ScrollCountRole, IndexRole }; Q_ENUM(OmobiDisplayTextModelRole) enum text_align_t { AlignLeft, AlignCenter, AlignRignt }; int rowCount(const QModelIndex & = QModelIndex()) const; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; QHash roleNames() const; Q_INVOKABLE void append( QString text, bool active, unsigned int runtime, QString color, QString alignment, bool scroll, unsigned int scrollSpeed, unsigned int scrollCount ); void append(const QMap &roles); bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); Q_INVOKABLE void remove(int row); protected: OmobiDisplayTextModel(QObject* parent = nullptr); bool setTexts(QList> json); QList> getTexts(); void clear(); private: QList> texts; }; #endif // OMOBIDISPLAYTEXTMODEL_H