VariableModel.h
55 lines
| 1.7 KiB
| text/x-c
|
CLexer
|
r107 | #ifndef SCIQLOP_VARIABLEMODEL_H | ||
#define SCIQLOP_VARIABLEMODEL_H | ||||
r212 | ||||
#include <Data/SqpDateTime.h> | ||||
|
r107 | |||
|
r140 | #include <QAbstractTableModel> | ||
|
r107 | #include <QLoggingCategory> | ||
r212 | #include <Common/spimpl.h> | |||
|
r107 | Q_DECLARE_LOGGING_CATEGORY(LOG_VariableModel) | ||
|
r153 | class IDataSeries; | ||
|
r107 | class Variable; | ||
/** | ||||
* @brief The VariableModel class aims to hold the variables that have been created in SciQlop | ||||
*/ | ||||
|
r140 | class VariableModel : public QAbstractTableModel { | ||
|
r107 | public: | ||
|
r140 | explicit VariableModel(QObject *parent = nullptr); | ||
|
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 | |||
|
r153 | * @return the pointer to the new variable | ||
|
r107 | */ | ||
r294 | std::shared_ptr<Variable> createVariable(const QString &name, | |||
const SqpDateTime &dateTime) noexcept; | ||||
|
r107 | |||
|
r306 | /** | ||
* Deletes a variable from the model, if it exists | ||||
* @param variable the variable to delete | ||||
*/ | ||||
void deleteVariable(std::shared_ptr<Variable> variable) noexcept; | ||||
|
r229 | std::shared_ptr<Variable> variable(int index) const; | ||
|
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; | ||||
|
r107 | private: | ||
class VariableModelPrivate; | ||||
spimpl::unique_impl_ptr<VariableModelPrivate> impl; | ||||
}; | ||||
#endif // SCIQLOP_VARIABLEMODEL_H | ||||