#pragma once // qt #include #include #include // goodies #include "g_property.h" class SeriesModel : public QAbstractTableModel { Q_OBJECT G_PROPERTY(float, minX); G_PROPERTY(float, maxX); G_PROPERTY(float, minY); G_PROPERTY(float, maxY); public: Q_INVOKABLE SeriesModel(QObject* parent = nullptr); Q_INVOKABLE SeriesModel(const SeriesModel& other); Q_INVOKABLE ~SeriesModel() Q_DECL_OVERRIDE = default; public: Q_INVOKABLE int rowCount( const QModelIndex& parent = QModelIndex() ) const Q_DECL_OVERRIDE; Q_INVOKABLE int columnCount( const QModelIndex& parent = QModelIndex() ) const Q_DECL_OVERRIDE; Q_INVOKABLE QVariant data( const QModelIndex& modelIndex, int role = Qt::DisplayRole ) const Q_DECL_OVERRIDE; public slots: void append(const QVector points); void replace(const QVector points); void clear(); void recalcLimits(); protected: QVector m_points; QMutex m_mtx; }; Q_DECLARE_METATYPE(SeriesModel);