/** * @RDE_HEADER@ * The model is used to handle CheckState Boxes in an LtsDataView (QTreeModel). * Only the nodes of a TreeView are handled in this model. Leaves are forwarded to the transferred model and must be edited there. * $Id$ * $HeadURL$ * $Author$ * Created by hjl/Christian Froebel, NLE, 2019-05-10 */ #pragma once #include #include "lts_data_view_export.h" namespace LtsDataView { class LTSDATAVIEW_EXPORT CheckStateProxyModel : public QIdentityProxyModel { public: using QIdentityProxyModel::QIdentityProxyModel; /** * Handles the 'ItemIsUserCheckable' flags * @param[in] sourceModel index * */ Qt::ItemFlags flags(const QModelIndex &index) const override; /** * Handles the representation of data * @param[in] sourceModel index * @param[in] role role to which the data relates * */ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; /** * Handles the storage of data * @param[in] index index * @param[in] value value to be set * @param[in] role role to which the data relates * */ bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override; private: /** * Returns true if the item with the given index is an leaf * @param[in] index item index whose information is requested * will be internally mapped to source model data */ bool isLeaf(const QModelIndex &index) const; }; // class CheckStateProxyModel } // namespace LtsDataView