##// END OF EJS Templates
Adapts VariableModel to be a QabstractTableModel...
Adapts VariableModel to be a QabstractTableModel The mechanism proposed by Qt makes it easy to display the model in a QTableView

File last commit:

r149:5bdc904b0565
r149:5bdc904b0565
Show More
VariableModel.h
41 lines | 1.3 KiB | text/x-c | CLexer
Alexandre Leroux
Creates the variable model...
r112 #ifndef SCIQLOP_VARIABLEMODEL_H
#define SCIQLOP_VARIABLEMODEL_H
#include <Common/spimpl.h>
Alexandre Leroux
Adapts VariableModel to be a QabstractTableModel...
r149 #include <QAbstractTableModel>
Alexandre Leroux
Creates the variable model...
r112 #include <QLoggingCategory>
Q_DECLARE_LOGGING_CATEGORY(LOG_VariableModel)
class Variable;
/**
* @brief The VariableModel class aims to hold the variables that have been created in SciQlop
*/
Alexandre Leroux
Adapts VariableModel to be a QabstractTableModel...
r149 class VariableModel : public QAbstractTableModel {
Alexandre Leroux
Creates the variable model...
r112 public:
Alexandre Leroux
Adapts VariableModel to be a QabstractTableModel...
r149 explicit VariableModel(QObject *parent = nullptr);
Alexandre Leroux
Creates the variable model...
r112
/**
* Creates a new variable in the model
* @param name the name of the new variable
* @return the variable if it was created successfully, nullptr otherwise
*/
Variable *createVariable(const QString &name) noexcept;
Alexandre Leroux
Adapts VariableModel to be a QabstractTableModel...
r149 // /////////////////////////// //
// 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
Creates the variable model...
r112 private:
class VariableModelPrivate;
spimpl::unique_impl_ptr<VariableModelPrivate> impl;
};
#endif // SCIQLOP_VARIABLEMODEL_H