VariableModel.h
51 lines
| 1.6 KiB
| text/x-c
|
CLexer
Alexandre Leroux
|
r107 | #ifndef SCIQLOP_VARIABLEMODEL_H | ||
#define SCIQLOP_VARIABLEMODEL_H | ||||
r212 | ||||
#include <Data/SqpDateTime.h> | ||||
Alexandre Leroux
|
r107 | |||
Alexandre Leroux
|
r140 | #include <QAbstractTableModel> | ||
Alexandre Leroux
|
r107 | #include <QLoggingCategory> | ||
r212 | #include <Common/spimpl.h> | |||
Alexandre Leroux
|
r107 | Q_DECLARE_LOGGING_CATEGORY(LOG_VariableModel) | ||
Alexandre Leroux
|
r153 | class IDataSeries; | ||
Alexandre Leroux
|
r107 | class Variable; | ||
/** | ||||
* @brief The VariableModel class aims to hold the variables that have been created in SciQlop | ||||
*/ | ||||
Alexandre Leroux
|
r140 | class VariableModel : public QAbstractTableModel { | ||
Alexandre Leroux
|
r107 | public: | ||
Alexandre Leroux
|
r140 | explicit VariableModel(QObject *parent = nullptr); | ||
Alexandre Leroux
|
r107 | |||
/** | ||||
* Creates a new variable in the model | ||||
* @param name the name of the new variable | ||||
r212 | * @param dateTime the dateTime of the new variable | |||
Alexandre Leroux
|
r153 | * @param defaultDataSeries the default data of the new variable | ||
* @return the pointer to the new variable | ||||
Alexandre Leroux
|
r107 | */ | ||
Alexandre Leroux
|
r153 | std::shared_ptr<Variable> | ||
r212 | createVariable(const QString &name, const SqpDateTime &dateTime, | |||
std::unique_ptr<IDataSeries> defaultDataSeries) noexcept; | ||||
Alexandre Leroux
|
r107 | |||
Alexandre Leroux
|
r229 | std::shared_ptr<Variable> variable(int index) const; | ||
Alexandre Leroux
|
r140 | // /////////////////////////// // | ||
// QAbstractTableModel methods // | ||||
// /////////////////////////// // | ||||
virtual int columnCount(const QModelIndex &parent = QModelIndex{}) const override; | ||||
virtual int rowCount(const QModelIndex &parent = QModelIndex{}) const override; | ||||
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; | ||||
virtual QVariant headerData(int section, Qt::Orientation orientation, | ||||
int role = Qt::DisplayRole) const override; | ||||
Alexandre Leroux
|
r107 | private: | ||
class VariableModelPrivate; | ||||
spimpl::unique_impl_ptr<VariableModelPrivate> impl; | ||||
}; | ||||
#endif // SCIQLOP_VARIABLEMODEL_H | ||||