Official websites use .gov
A .gov website belongs to an official government organization in the United States.

Secure .gov websites use HTTPS
A lock ( ) or https:// means you’ve safely connected to the .gov website. Share sensitive information only on official, secure websites.

Isis 3 Programmer Reference
AbstractTreeModel.h
1#ifndef AbstractTreeModel_H
2#define AbstractTreeModel_H
3
9
10/* SPDX-License-Identifier: CC0-1.0 */
11#include <functional>
12
13#include <QObject>
14
15
16class QFont;
17template <typename A> class QFutureWatcher;
18class QModelIndex;
19class QMutex;
20class QSize;
21class QString;
22
23
24namespace Isis {
25 class AbstractTreeItem;
26 class BusyLeafItem;
27 class ControlNet;
28 class FilterWidget;
29 class RootItem;
30 class TreeView;
31
47 class AbstractTreeModel : public QObject {
48 Q_OBJECT
49
50 public:
51 enum InterestingItems {
52 PointItems = 1,
53 MeasureItems = 2,
54 ImageItems = 4,
55 AllItems = PointItems | MeasureItems | ImageItems
56 };
57 Q_DECLARE_FLAGS(InterestingItemsFlag, InterestingItems)
58
59
60 public:
61 AbstractTreeModel(ControlNet *controlNet, TreeView *v,
62 QObject *parent = 0);
63 virtual ~AbstractTreeModel();
64
65 QList< AbstractTreeItem * > getItems(int, int,
66 InterestingItemsFlag = AllItems, bool = false);
68 AbstractTreeItem *, InterestingItemsFlag = AllItems, bool = false);
69 QList< AbstractTreeItem * > getSelectedItems(
70 InterestingItemsFlag = AllItems, bool = false);
71 QMutex *getMutex() const;
72 int getItemCount(InterestingItemsFlag) const;
73 int getTopLevelItemCount() const;
74 int getVisibleItemCount(InterestingItemsFlag, bool) const;
75 int getVisibleTopLevelItemCount() const;
76 TreeView *getView() const;
77 void setDrivable(bool drivableStatus);
78 bool isDrivable() const;
79 bool isFiltering() const;
80 bool isRebuilding() const;
81 void setRebuilding(bool running) { m_rebuildRunning = running; }
82 void setFilter(FilterWidget *newFilter);
83 void setGlobalSelection(bool selected, InterestingItemsFlag = AllItems);
84 void stopWorking();
85 QSize getVisibleSize(int indentation) const;
86 int indexOfVisibleItem(AbstractTreeItem const *item,
87 InterestingItemsFlag = AllItems,
88 bool = false) const;
89 void setFrozen(bool);
90 bool isFrozen() const;
91 void queueRebuild();
92
93
94 public slots:
95 void applyFilter();
96
97
98 signals:
99 void cancelSort();
100 void modelModified();
101 void filterProgressChanged(int);
102 void filterProgressRangeChanged(int, int);
103 void rebuildProgressChanged(int);
104 void rebuildProgressRangeChanged(int, int);
105 void treeSelectionChanged(QList<AbstractTreeItem *>);
106 void tableSelectionChanged(QList<AbstractTreeItem *>);
107
113 void filterCountsChanged(int visibleTopLevelItemCount,
114 int topLevelItemCount);
115
116
117 public:
118 virtual void rebuildItems() = 0;
119
120
121 private:
122 AbstractTreeModel(const AbstractTreeModel &);
123 AbstractTreeModel &operator=(const AbstractTreeModel &);
124
125
126 private:
127 AbstractTreeItem *nextItem(AbstractTreeItem *current,
128 InterestingItemsFlag flags, bool ignoreExpansion) const;
129 void selectItems(AbstractTreeItem *item, bool select,
130 InterestingItemsFlag flags);
131 static bool itemIsInteresting(
132 AbstractTreeItem *, InterestingItemsFlag);
133 int getItemCount(AbstractTreeItem *, InterestingItemsFlag) const;
134
135
136 private slots:
137 void applyFilterDone();
138 void rebuildItemsDone();
139
140
141 protected:
142 void clear();
143 ControlNet *getControlNetwork() const;
144 FilterWidget *getFilterWidget() const;
145
147 getRebuildWatcher() const;
148
149 RootItem *getRootItem() const;
150
151
152 protected:
153 RootItem *rootItem;
154
155
156 private: // data
159 QList< QPair< QString, QString > > * m_expandedState;
160 QList< QPair< QString, QString > > * m_selectedState;
161 QMutex *m_mutex;
162 BusyLeafItem *m_busyItem;
163 TreeView *m_view;
164 ControlNet *m_cNet;
165 FilterWidget *m_guisFilterWidget;
166 FilterWidget *m_localFilterWidgetCopy;
167 bool m_drivable;
168 bool m_filterAgain;
169 bool m_filterRunning;
170 bool m_rebuildRunning;
171 bool m_frozen;
172 bool m_rebuildPending;
173
174
175 private:
181 class FilterFunctor
182 : public std::function<bool(AbstractTreeItem *const &)> {
183 public:
184 FilterFunctor(FilterWidget *fw);
185 FilterFunctor(FilterFunctor const &other);
186 ~FilterFunctor();
187 bool operator()(AbstractTreeItem *const &) const;
188 FilterFunctor &operator=(FilterFunctor const &);
189 void filterWorker(AbstractTreeItem *) const;
190
191 static void updateTopLevelLinks(
193 AbstractTreeItem *const &item);
194
195
196 private:
197 FilterWidget *m_filter;
198 };
199 };
200
201 Q_DECLARE_OPERATORS_FOR_FLAGS(AbstractTreeModel::InterestingItemsFlag)
202
203}
204
205
206#endif
Base class for an item in the tree.
void filterCountsChanged(int visibleTopLevelItemCount, int topLevelItemCount)
This signal is emitted after filtering to provide the number of visible top-level items remaining aft...
QSize getVisibleSize(int indentation) const
indentation is in pixels
A leaf item that is not ready for user interaction.
a control network
Definition ControlNet.h:257
This widget contains filtering capabilities for a single filter type.
The root of a tree.
Definition RootItem.h:37
This is free and unencumbered software released into the public domain.
This is free and unencumbered software released into the public domain.
This is free and unencumbered software released into the public domain.
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16