Isis Developer Reference
AbstractTreeItem.h
Go to the documentation of this file.
1#ifndef AbstractTreeItem_H
2#define AbstractTreeItem_H
3
10/* SPDX-License-Identifier: CC0-1.0 */
11
12#include <QObject>
13
14class QFontMetrics;
15template< typename T > class QList;
16class QString;
17class QVariant;
18
19
20namespace Isis {
21 class ControlPoint;
22 class ControlMeasure;
23
39 class AbstractTreeItem : public QObject {
40
41 Q_OBJECT
42
43 public:
50
51
52 public:
54 virtual ~AbstractTreeItem();
55
56 AbstractTreeItem *parent() const;
57 void setParent(AbstractTreeItem *newParent);
58
59 int row() const;
60
61 // These methods are designed to be implemented either by
62 // AbstractParentItem or AbstractLeafItem.
63 virtual void addChild(AbstractTreeItem *child) = 0;
64 virtual QList< AbstractTreeItem * > getChildren() const = 0;
65 virtual AbstractTreeItem *childAt(int row) const = 0;
66 virtual int childCount() const = 0;
69 virtual int indexOf(AbstractTreeItem *child) const = 0;
70 virtual void setFirstVisibleChild(AbstractTreeItem *child) = 0;
71 virtual void setLastVisibleChild(AbstractTreeItem *child) = 0;
72
73 // These methods are designed to be implemented either by
74 // AbstractPointItem, AbstractMeasureItem, AbstractSerialItem,
75 // or AbstractNullDataItem.
76 virtual QVariant getData() const = 0;
77 virtual QVariant getData(QString columnTitle) const = 0;
78 virtual void setData(QString const &columnTitle,
79 QString const &newData) = 0;
80 virtual bool isDataEditable(QString columnTitle) const = 0;
81 virtual void deleteSource() = 0;
83 virtual void *getPointer() const = 0;
84
85 // There are things that every AbstractTreeItem can do.
86 virtual QString getFormattedData() const;
87 virtual QString getFormattedData(QString columnTitle) const;
88
89 virtual bool hasMeasure(ControlMeasure *) const;
90 virtual bool hasImage(QString imageSerial) const;
91 virtual bool hasPoint(ControlPoint *) const;
92
93 virtual AbstractTreeItem *getNextVisiblePeer() const;
94 virtual void setNextVisiblePeer(AbstractTreeItem *next);
95
96 virtual void setExpanded(bool newState);
97 virtual bool isExpanded() const;
98
99 virtual void setSelected(bool newState);
100 virtual void setSelectable(bool newSelectable);
101 virtual bool isSelected() const;
102 virtual bool isSelectable() const;
103
104 virtual void setVisible(bool newState);
105 virtual bool isVisible() const;
106
107 virtual int getDataWidth() const;
108 virtual int getDepth() const;
109
111 virtual const AbstractTreeItem *getLastVisibleFilteredItem() const;
112
113 protected slots:
114 virtual void sourceDeleted() = 0;
115
116 protected:
117 virtual void calcDataWidth(int avgCharWidth);
118 static double catchNull(QString);
119 static QString catchNull(QVariant);
120
121
122 // disable copying of this class
123 private:
125 AbstractTreeItem &operator=(AbstractTreeItem const &);
126
127
128 private:
129 AbstractTreeItem *m_nextVisibleItem;
130 AbstractTreeItem *m_parentItem;
131 bool m_expanded;
132 bool m_selectable;
133 bool m_selected;
134 bool m_visible;
135 int m_dataWidth;
136 };
137}
138
139#endif
Base class for an item in the tree.
Definition AbstractTreeItem.h:39
int row() const
Definition AbstractTreeItem.cpp:53
virtual QString getFormattedData() const
Definition AbstractTreeItem.cpp:63
virtual AbstractTreeItem * getFirstVisibleChild() const =0
virtual void setLastVisibleFilteredItem(AbstractTreeItem *item)
Definition AbstractTreeItem.cpp:178
virtual bool isSelected() const
Definition AbstractTreeItem.cpp:133
virtual void deleteSource()=0
virtual void setFirstVisibleChild(AbstractTreeItem *child)=0
virtual void sourceDeleted()=0
virtual const AbstractTreeItem * getLastVisibleFilteredItem() const
Definition AbstractTreeItem.cpp:186
virtual bool hasPoint(ControlPoint *) const
Definition AbstractTreeItem.cpp:83
virtual ~AbstractTreeItem()
Definition AbstractTreeItem.cpp:37
virtual QVariant getData() const =0
AbstractTreeItem * parent() const
Definition AbstractTreeItem.cpp:43
virtual void setExpanded(bool newState)
Definition AbstractTreeItem.cpp:114
virtual int getDepth() const
Definition AbstractTreeItem.cpp:164
virtual int getDataWidth() const
Definition AbstractTreeItem.cpp:153
virtual void setLastVisibleChild(AbstractTreeItem *child)=0
virtual bool isSelectable() const
Definition AbstractTreeItem.cpp:138
virtual AbstractTreeItem * childAt(int row) const =0
virtual void setData(QString const &columnTitle, QString const &newData)=0
virtual int childCount() const =0
InternalPointerType
Definition AbstractTreeItem.h:44
@ None
Definition AbstractTreeItem.h:45
@ Point
Definition AbstractTreeItem.h:46
@ ImageAndNet
Definition AbstractTreeItem.h:48
@ Measure
Definition AbstractTreeItem.h:47
virtual QVariant getData(QString columnTitle) const =0
virtual void calcDataWidth(int avgCharWidth)
Definition AbstractTreeItem.cpp:191
virtual InternalPointerType getPointerType() const =0
virtual void setSelectable(bool newSelectable)
Definition AbstractTreeItem.cpp:128
virtual int indexOf(AbstractTreeItem *child) const =0
virtual QList< AbstractTreeItem * > getChildren() const =0
virtual void addChild(AbstractTreeItem *child)=0
virtual bool hasImage(QString imageSerial) const
Definition AbstractTreeItem.cpp:103
AbstractTreeItem(AbstractTreeItem *parent=0)
Definition AbstractTreeItem.cpp:26
virtual bool hasMeasure(ControlMeasure *) const
Definition AbstractTreeItem.cpp:93
virtual AbstractTreeItem * getLastVisibleChild() const =0
virtual AbstractTreeItem * getNextVisiblePeer() const
Definition AbstractTreeItem.cpp:73
void setParent(AbstractTreeItem *newParent)
Definition AbstractTreeItem.cpp:48
static double catchNull(QString)
Definition AbstractTreeItem.cpp:221
virtual void setNextVisiblePeer(AbstractTreeItem *next)
Definition AbstractTreeItem.cpp:78
virtual void * getPointer() const =0
virtual bool isExpanded() const
Definition AbstractTreeItem.cpp:118
virtual bool isVisible() const
Definition AbstractTreeItem.cpp:148
virtual bool isDataEditable(QString columnTitle) const =0
virtual void setSelected(bool newState)
Definition AbstractTreeItem.cpp:123
virtual void setVisible(bool newState)
Definition AbstractTreeItem.cpp:143
a control measurement
Definition ControlMeasure.h:175
A single control point.
Definition ControlPoint.h:356
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