VTK  9.1.0
QFilterTreeProxyModel.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: QFilterTreeProxyModel.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
15/*-------------------------------------------------------------------------
16 Copyright 2008 Sandia Corporation.
17 Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
18 the U.S. Government retains certain rights in this software.
19-------------------------------------------------------------------------*/
20// .NAME QFilterTreeProxyModel - An implementation of a QSortFilterProxyModel
21// tailored for hierarchical models.
22//
23// .SECTION Description
24// An implementation of a QSortFilterProxyModel tailored for hierarchical
25// models. It allows you to filter the model based on the content in a
26// certain column of a certain level in the tree. Indices above that level
27// in the tree are retained. Indices below the level are kept if their
28// ancestor at the tree level is kept.
29//
30// .SECTION See also
31
32#ifndef __QFilterTreeProxyModel_h
33#define __QFilterTreeProxyModel_h
34
35#include "QVTKWin32Header.h"
36#include "vtkGUISupportQtModule.h" // For export macro
37#include <QSortFilterProxyModel>
38
39class QModelIndex;
40
41class VTKGUISUPPORTQT_EXPORT QFilterTreeProxyModel : public QSortFilterProxyModel
42{
43 Q_OBJECT
44
45public:
46 QFilterTreeProxyModel(QObject* p = nullptr);
48
49 // Description:
50 // The 0-based level in the tree hierarchy to filter on. The root is level 0.
52
53protected:
54 bool filterAcceptsRow(int sourceRow, const QModelIndex& sourceParent) const override;
55 bool lessThan(const QModelIndex& left, const QModelIndex& right) const override;
56
57private:
58 int TreeLevel;
59};
60
61#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:401