pqSignalAdaptorTreeWidget.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 pqSignalAdaptorTreeWidget_h
5 #define pqSignalAdaptorTreeWidget_h
6 
7 #include "pqComponentsModule.h"
8 #include <QList>
9 #include <QObject>
10 #include <QVariant>
11 
12 class QTreeWidget;
13 class QTreeWidgetItem;
14 
25 {
26  Q_OBJECT
27  Q_PROPERTY(QList<QVariant> values READ values WRITE setValues)
28 
29 public:
36  pqSignalAdaptorTreeWidget(QTreeWidget* treeWidget, bool editable);
37  ~pqSignalAdaptorTreeWidget() override;
38 
42  QList<QVariant> values() const;
43 
49  QTreeWidgetItem* appendValue(const QList<QVariant>& values);
50  QTreeWidgetItem* appendValue(const QStringList& values);
51 
60  void setItemCreatorFunction(QTreeWidgetItem*(fptr)(QTreeWidget*, const QStringList&))
61  {
62  this->ItemCreatorFunctionPtr = fptr;
63  }
64 Q_SIGNALS:
68  void valuesChanged();
69 
74  void tableGrown(QTreeWidgetItem* item);
75 
76 public Q_SLOTS:
80  void setValues(const QList<QVariant>&);
81 
86  QTreeWidgetItem* growTable();
87 
88 private Q_SLOTS:
89  void sort(int);
90 
91 private: // NOLINT(readability-redundant-access-specifiers)
92  Q_DISABLE_COPY(pqSignalAdaptorTreeWidget)
93 
94 
97  void appendItem(QTreeWidgetItem* item);
98 
102  QTreeWidgetItem* newItem(const QStringList& columnValues);
103 
104  void updateSortingLinks();
105 
106  QTreeWidget* TreeWidget;
107  bool Editable;
108  bool Sortable;
109  QTreeWidgetItem* (*ItemCreatorFunctionPtr)(QTreeWidget*, const QStringList&);
110 };
111 
112 #endif
#define PQCOMPONENTS_EXPORT
void setItemCreatorFunction(QTreeWidgetItem *(fptr)(QTreeWidget *, const QStringList &))
This adaptor create QTreeWidgetItem instances by default when new entries are to be shown in the widg...
pqSignalAdaptorTreeWidget can be used to connect any property with repeat_command to a tree widget th...