VTK  9.3.20240419
QFilterTreeProxyModel.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-FileCopyrightText: Copyright 2008 Sandia Corporation
3 // SPDX-License-Identifier: LicenseRef-BSD-3-Clause-Sandia-USGov
4 // .NAME QFilterTreeProxyModel - An implementation of a QSortFilterProxyModel
5 // tailored for hierarchical models.
6 //
7 // .SECTION Description
8 // An implementation of a QSortFilterProxyModel tailored for hierarchical
9 // models. It allows you to filter the model based on the content in a
10 // certain column of a certain level in the tree. Indices above that level
11 // in the tree are retained. Indices below the level are kept if their
12 // ancestor at the tree level is kept.
13 //
14 // .SECTION See also
15 
16 #ifndef __QFilterTreeProxyModel_h
17 #define __QFilterTreeProxyModel_h
18 
19 #include "QVTKWin32Header.h"
20 #include "vtkGUISupportQtModule.h" // For export macro
21 #include <QSortFilterProxyModel>
22 
23 class QModelIndex;
24 VTK_ABI_NAMESPACE_BEGIN
25 
26 class VTKGUISUPPORTQT_EXPORT QFilterTreeProxyModel : public QSortFilterProxyModel
27 {
28  Q_OBJECT
29 
30 public:
31  QFilterTreeProxyModel(QObject* p = nullptr);
33 
34  // Description:
35  // The 0-based level in the tree hierarchy to filter on. The root is level 0.
37 
38 protected:
39  bool filterAcceptsRow(int sourceRow, const QModelIndex& sourceParent) const override;
40  bool lessThan(const QModelIndex& left, const QModelIndex& right) const override;
41 
42 private:
43  int TreeLevel;
44 };
45 
46 VTK_ABI_NAMESPACE_END
47 #endif
~QFilterTreeProxyModel() override
void setFilterTreeLevel(int level)
bool lessThan(const QModelIndex &left, const QModelIndex &right) const override
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override
QFilterTreeProxyModel(QObject *p=nullptr)
@ level
Definition: vtkX3D.h:395