| 18 | class AbstractAspect; |
| 19 | |
| 20 | class AspectTreeModel : public QAbstractItemModel { |
| 21 | Q_OBJECT |
| 22 | |
| 23 | public: |
| 24 | explicit AspectTreeModel(AbstractAspect* root, QObject* parent = nullptr); |
| 25 | void setRoot(AbstractAspect*); |
| 26 | |
| 27 | QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const override; |
| 28 | QModelIndex parent(const QModelIndex& index) const override; |
| 29 | int rowCount(const QModelIndex& parent = QModelIndex()) const override; |
| 30 | int columnCount(const QModelIndex& parent = QModelIndex()) const override; |
| 31 | |
| 32 | QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; |
| 33 | QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; |
| 34 | bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override; |
| 35 | Qt::ItemFlags flags(const QModelIndex& index) const override; |
| 36 | |
| 37 | QModelIndex modelIndexOfAspect(const AbstractAspect*, int column = 0) const; |
| 38 | QModelIndex modelIndexOfAspect(const QString& path, int column = 0) const; |
| 39 | |
| 40 | void setSelectableAspects(const QList<AspectType>&); |
| 41 | const QList<AspectType>& selectableAspects() const; |
| 42 | |
| 43 | void setReadOnly(bool); |
| 44 | void enablePlottableColumnsOnly(bool); |
| 45 | void enableNumericColumnsOnly(bool); |
| 46 | void enableNonEmptyNumericColumnsOnly(bool); |
| 47 | void enableShowPlotDesignation(bool); |
| 48 | void setFilterString(const QString&); |
| 49 | void setFilterCaseSensitivity(Qt::CaseSensitivity); |
| 50 | void setFilterMatchCompleteWord(bool); |
| 51 | |
| 52 | private Q_SLOTS: |
| 53 | void aspectDescriptionChanged(const AbstractAspect*); |
| 54 | void aspectAboutToBeAdded(const AbstractAspect* parent, const AbstractAspect* before, const AbstractAspect* child); |
| 55 | void aspectAdded(const AbstractAspect* parent); |
| 56 | void aspectAboutToBeRemoved(const AbstractAspect*); |
| 57 | void aspectRemoved(); |
| 58 | void aspectHiddenAboutToChange(const AbstractAspect*); |
| 59 | void aspectHiddenChanged(const AbstractAspect*); |
| 60 | void aspectSelectedInView(const AbstractAspect*); |
| 61 | void aspectDeselectedInView(const AbstractAspect*); |
| 62 | void renameRequestedSlot(); |
| 63 | void aspectAboutToBeMoved(const AbstractAspect*, int destinationRow); |
| 64 | void aspectMoved(); |
| 65 | |
| 66 | private: |
| 67 | AbstractAspect* m_root{nullptr}; |
| 68 | bool m_readOnly{false}; |
| 69 | bool m_folderSelectable{true}; |
| 70 | bool m_plottableColumnsOnly{false}; |
| 71 | bool m_numericColumnsOnly{false}; |
| 72 | bool m_nonEmptyNumericColumnsOnly{false}; |
| 73 | bool m_showPlotDesignation{false}; |
| 74 | /*! |
| 75 | * \brief m_selectableAspects |
| 76 | * Determines the types of selected aspects. If empty all aspects are selectable |
| 77 | */ |
nothing calls this directly
no test coverage detected