pqSelectionAdaptor.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 pqSelectionAdaptor_h
5 #define pqSelectionAdaptor_h
6 
7 #include "pqComponentsModule.h"
8 #include <QItemSelectionModel> //need for qtSelectionFlags
9 #include <QObject>
10 
12 class QAbstractItemModel;
13 class QModelIndex;
14 
23 {
24  Q_OBJECT
25 public:
26  ~pqSelectionAdaptor() override;
27 
31  QItemSelectionModel* getQSelectionModel() const { return this->QSelectionModel; }
32 
33 protected:
34  pqSelectionAdaptor(QItemSelectionModel* pipelineSelectionModel);
35 
39  virtual QModelIndex mapFromItem(pqServerManagerModelItem* item) const = 0;
40 
44  virtual pqServerManagerModelItem* mapToItem(const QModelIndex& index) const = 0;
45 
52  const QAbstractItemModel* getQModel() const;
53 
54 protected Q_SLOTS: // NOLINT(readability-redundant-access-specifiers)
58  virtual void selectionChanged();
59 
63  virtual void currentProxyChanged();
64  virtual void proxySelectionChanged();
65 
70  virtual QItemSelectionModel::SelectionFlag qtSelectionFlags() const
71  {
72  return QItemSelectionModel::NoUpdate;
73  }
74 
75 private:
81  QModelIndex mapToSource(const QModelIndex& inIndex) const;
82 
88  QModelIndex mapFromSource(const QModelIndex& inIndex, const QAbstractItemModel* model) const;
89 
90  QItemSelectionModel* QSelectionModel;
91  bool IgnoreSignals;
92 };
93 
94 #endif
#define PQCOMPONENTS_EXPORT
pqServerManagerModelItem is a element maintained by pqServerManagerModel.
index
QItemSelectionModel * getQSelectionModel() const
Returns a pointer to the QItemSelectionModel.
virtual QItemSelectionModel::SelectionFlag qtSelectionFlags() const
subclasses can override this method to provide model specific selection overrides such as QItemSelect...
pqSelectionAdaptor is the abstract base class for an adaptor that connects a QItemSelectionModel to p...