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 Developer Reference
AbstractTreeModel.h
Go to the documentation of this file.
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:
57 Q_DECLARE_FLAGS(InterestingItemsFlag, InterestingItems)
58
59
60 public:
62 QObject *parent = 0);
63 virtual ~AbstractTreeModel();
64
66 InterestingItemsFlag = AllItems, bool = false);
68 AbstractTreeItem *, InterestingItemsFlag = AllItems, bool = false);
70 InterestingItemsFlag = AllItems, bool = false);
71 QMutex *getMutex() const;
72 int getItemCount(InterestingItemsFlag) const;
73 int getTopLevelItemCount() const;
74 int getVisibleItemCount(InterestingItemsFlag, bool) 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;
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();
107
113 void filterCountsChanged(int visibleTopLevelItemCount,
114 int topLevelItemCount);
115
116
117 public:
118 virtual void rebuildItems() = 0;
119
120
121 private:
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();
145
147 getRebuildWatcher() const;
148
149 RootItem *getRootItem() const;
150
151
152 protected:
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.
Definition AbstractTreeItem.h:39
QList< AbstractTreeItem * > getSelectedItems(InterestingItemsFlag=AllItems, bool=false)
Definition AbstractTreeModel.cpp:228
RootItem * getRootItem() const
Definition AbstractTreeModel.cpp:388
void filterProgressRangeChanged(int, int)
int getItemCount(InterestingItemsFlag) const
Definition AbstractTreeModel.cpp:255
void setRebuilding(bool running)
Definition AbstractTreeModel.h:81
void setFrozen(bool)
Definition AbstractTreeModel.cpp:325
QList< AbstractTreeItem * > getItems(int, int, InterestingItemsFlag=AllItems, bool=false)
Definition AbstractTreeModel.cpp:118
void setDrivable(bool drivableStatus)
void filterProgressChanged(int)
int indexOfVisibleItem(AbstractTreeItem const *item, InterestingItemsFlag=AllItems, bool=false) const
Definition AbstractTreeModel.cpp:302
void filterCountsChanged(int visibleTopLevelItemCount, int topLevelItemCount)
This signal is emitted after filtering to provide the number of visible top-level items remaining aft...
RootItem * rootItem
Definition AbstractTreeModel.h:153
void clear()
Definition AbstractTreeModel.cpp:369
void setFilter(FilterWidget *newFilter)
Definition AbstractTreeModel.cpp:359
TreeView * getView() const
Definition AbstractTreeModel.cpp:393
FilterWidget * getFilterWidget() const
QMutex * getMutex() const
Definition AbstractTreeModel.cpp:250
InterestingItems
Definition AbstractTreeModel.h:51
@ MeasureItems
Definition AbstractTreeModel.h:53
@ AllItems
Definition AbstractTreeModel.h:55
@ ImageItems
Definition AbstractTreeModel.h:54
@ PointItems
Definition AbstractTreeModel.h:52
int getTopLevelItemCount() const
Definition AbstractTreeModel.cpp:260
void setGlobalSelection(bool selected, InterestingItemsFlag=AllItems)
Definition AbstractTreeModel.cpp:476
int getVisibleTopLevelItemCount() const
Definition AbstractTreeModel.cpp:285
bool isFiltering() const
Definition AbstractTreeModel.cpp:349
QFutureWatcher< QAtomicPointer< RootItem > > * getRebuildWatcher() const
Definition AbstractTreeModel.cpp:383
void rebuildProgressChanged(int)
virtual void rebuildItems()=0
bool isRebuilding() const
Definition AbstractTreeModel.cpp:354
void queueRebuild()
Definition AbstractTreeModel.cpp:344
int getVisibleItemCount(InterestingItemsFlag, bool) const
Definition AbstractTreeModel.cpp:264
bool isFrozen() const
Definition AbstractTreeModel.cpp:339
void rebuildProgressRangeChanged(int, int)
virtual ~AbstractTreeModel()
Definition AbstractTreeModel.cpp:85
QSize getVisibleSize(int indentation) const
indentation is in pixels
Definition AbstractTreeModel.cpp:407
void treeSelectionChanged(QList< AbstractTreeItem * >)
void applyFilter()
Definition AbstractTreeModel.cpp:434
void stopWorking()
Definition AbstractTreeModel.cpp:398
void tableSelectionChanged(QList< AbstractTreeItem * >)
AbstractTreeModel(ControlNet *controlNet, TreeView *v, QObject *parent=0)
Definition AbstractTreeModel.cpp:42
ControlNet * getControlNetwork() const
Definition AbstractTreeModel.cpp:377
A leaf item that is not ready for user interaction.
Definition BusyLeafItem.h:33
a control network
Definition ControlNet.h:257
This widget contains filtering capabilities for a single filter type.
Definition FilterWidget.h:57
The root of a tree.
Definition RootItem.h:37
Definition TreeView.h:31
This is free and unencumbered software released into the public domain.
Definition ConcurrentControlNetReader.h:21
This is free and unencumbered software released into the public domain.
Definition AbstractTableModel.h:24
This is free and unencumbered software released into the public domain.
Definition BoxcarCachingAlgorithm.h:13
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16