pqTreeViewSelectionHelper.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 pqTreeViewSelectionHelper_h
5 #define pqTreeViewSelectionHelper_h
6 
7 #include "pqWidgetsModule.h"
8 #include <QAbstractItemView>
9 #include <QItemSelection>
10 #include <QObject>
11 
37 {
38  Q_OBJECT
39  typedef QObject Superclass;
40  Q_PROPERTY(bool filterable READ isFilterable WRITE setFilterable);
41 
42 public:
43  pqTreeViewSelectionHelper(QAbstractItemView* view, bool customIndicator = true);
44  ~pqTreeViewSelectionHelper() override;
45 
47 
52  bool isFilterable() const { return this->Filterable; }
53  void setFilterable(bool val) { this->Filterable = val; }
55 
56 protected:
57  virtual void buildupMenu(QMenu& menu, int section, const QPoint& pos);
58  QAbstractItemView* TreeView;
59 
60 protected Q_SLOTS: // NOLINT(readability-redundant-access-specifiers)
61  virtual void showContextMenu(int section, const QPoint&);
62 
63 private:
64  Q_DISABLE_COPY(pqTreeViewSelectionHelper);
65 
66  void setSelectedItemsCheckState(Qt::CheckState state);
67  bool Filterable;
68 };
69 
70 #endif
helper class to add selection/sort/filter context menu to QAbstractItemView.
void setFilterable(bool val)
This property holds whether the tree view support filtering.
bool isFilterable() const
This property holds whether the tree view support filtering.
#define PQWIDGETS_EXPORT