Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
+60
@@ -0,0 +1,60 @@
|
||||
/**
|
||||
* @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 <QIdentityProxyModel>
|
||||
|
||||
#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
|
||||
|
||||
Reference in new issue
Block a user