pqAbstractItemSelectionModel.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-FileCopyrightText: Copyright (c) Sandia Corporation
3 // SPDX-License-Identifier: BSD-3-Clause
4 #ifndef pqAbstractItemSelectionModel_h
5 #define pqAbstractItemSelectionModel_h
6 
7 #include <QAbstractItemModel>
8 
9 class QTreeWidgetItem;
10 class vtkSMProxy;
11 
17 class pqAbstractItemSelectionModel : public QAbstractItemModel
18 {
19  Q_OBJECT
20 
21 protected:
22  pqAbstractItemSelectionModel(QObject* parent_ = nullptr);
24 
29  int rowCount(const QModelIndex& parent_ = QModelIndex()) const override;
30  int columnCount(const QModelIndex& parent_ = QModelIndex()) const override;
31 
32  QModelIndex index(int row, int column, const QModelIndex& parent_ = QModelIndex()) const override;
33  QModelIndex parent(const QModelIndex& index_) const override;
34  QVariant data(const QModelIndex& index_, int role = Qt::DisplayRole) const override;
35  bool setData(const QModelIndex& index_, const QVariant& value, int role) override;
36  QVariant headerData(
37  int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
38  Qt::ItemFlags flags(const QModelIndex& index_) const override;
46  virtual void populateModel(void* dataObject) = 0;
47 
51  virtual void initializeRootItem() = 0;
52 
56  bool isIndexValid(const QModelIndex& index_) const;
57 
58  QTreeWidgetItem* RootItem;
59 };
60 
61 #endif
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
QAbstractItemModel implementation.
bool isIndexValid(const QModelIndex &index_) const
Helper for a more comprehensive validation of indices.
QVariant data(const QModelIndex &index_, int role=Qt::DisplayRole) const override
QAbstractItemModel implementation.
bool setData(const QModelIndex &index_, const QVariant &value, int role) override
QAbstractItemModel implementation.
pqAbstractItemSelectionModel(QObject *parent_=nullptr)
virtual void populateModel(void *dataObject)=0
Concrete classes should implement how the model is to be populated.
int rowCount(const QModelIndex &parent_=QModelIndex()) const override
QAbstractItemModel implementation.
virtual void initializeRootItem()=0
Initialize the root item which holds the header tags.
Qt::ItemFlags flags(const QModelIndex &index_) const override
QAbstractItemModel implementation.
int columnCount(const QModelIndex &parent_=QModelIndex()) const override
QAbstractItemModel implementation.
proxy for a VTK object(s) on a server
Definition: vtkSMProxy.h:140
value
orientation
QModelIndex parent(const QModelIndex &index_) const override
QAbstractItemModel implementation.
Abstract class implementing a tree model with checkable items.
QModelIndex index(int row, int column, const QModelIndex &parent_=QModelIndex()) const override
QAbstractItemModel implementation.
~pqAbstractItemSelectionModel() override