Isis Developer Reference
TreeViewContent.h
Go to the documentation of this file.
1 #ifndef TreeViewContent_H
2 #define TreeViewContent_H
3 
10 /* SPDX-License-Identifier: CC0-1.0 */
11 
12 // parent
13 #include <QAbstractScrollArea>
14 
15 
16 class QEvent;
17 class QKeyEvent;
18 template< typename T > class QList;
19 class QMouseEvent;
20 class QPoint;
21 class QResizeEvent;
22 
23 
24 namespace Isis {
25  class AbstractTreeItem;
26  class AbstractTreeModel;
27  class TreeView;
28 
37  Q_OBJECT
38 
39  public:
40  TreeViewContent(QWidget *parent);
41  virtual ~TreeViewContent();
42  QSize minimumSizeHint() const;
43  QSize sizeHint() const;
45  void setModel(AbstractTreeModel *someModel);
46 
47 
48  signals:
51 
52 
53  public slots:
54  void refresh();
55 
56 
57  protected:
58  bool eventFilter(QObject *target, QEvent *event);
59  void keyPressEvent(QKeyEvent *event);
60  void leaveEvent(QEvent *event);
61  void mouseDoubleClickEvent(QMouseEvent *event);
62  void mouseMoveEvent(QMouseEvent *event);
63  void mousePressEvent(QMouseEvent *event);
64  void mouseReleaseEvent(QMouseEvent *event);
65  void paintEvent(QPaintEvent *event);
66  void resizeEvent(QResizeEvent *event);
67  void scrollContentsBy(int dx, int dy);
68 
69 
70  private:
71  TreeViewContent(const TreeViewContent &other);
72  TreeViewContent &operator=(const TreeViewContent &other);
73 
74 
75  private:
76  void nullify();
77  void paintItemText(QPainter *, int, QPoint, QPoint);
78  void drawCollapsedArrow(QPainter *, QRect);
79  void drawExpandedArrow(QPainter *, QRect);
80  QRect getArrowRect(AbstractTreeItem *item) const;
81 
82 
83  private slots:
84  void scrollTo(QList< AbstractTreeItem * >);
85  void scrollTo(AbstractTreeItem *);
86  void setAlternatingRowColors(bool);
87  void updateItemList();
88 
89 
90  private:
91  TreeView *m_parentView;
92  AbstractTreeModel *m_model;
94 
96  QPair< AbstractTreeItem *, bool > * m_pressedItem;
97 
99  QPair< AbstractTreeItem *, bool > * m_hoveredItem;
100 
101  AbstractTreeItem *m_lastDirectlySelectedItem;
102  QList<AbstractTreeItem *> * m_lastShiftSelection;
103 
104  QPoint *m_mousePressPos;
105  int m_rowHeight;
106  int m_contentWidth;
107  bool m_alternatingRowColors;
108 
109 
110  private:
111  static const int ITEM_PADDING = 4;
112  static const int ITEM_INDENTATION = 23;
113  };
114 }
115 
116 #endif
QAbstractScrollArea
Isis::AbstractTreeModel::getVisibleSize
QSize getVisibleSize(int indentation) const
indentation is in pixels
Definition: AbstractTreeModel.cpp:414
Isis::AbstractTreeItem::Point
@ Point
Definition: AbstractTreeItem.h:46
QWidget
Isis::TreeViewContent::refresh
void refresh()
Definition: TreeViewContent.cpp:129
Isis::AbstractTreeItem::getFirstVisibleChild
virtual AbstractTreeItem * getFirstVisibleChild() const =0
Isis::AbstractTreeModel::AllItems
@ AllItems
Definition: AbstractTreeModel.h:55
TableColumn.h
TreeViewContent.h
QList
This is free and unencumbered software released into the public domain.
Definition: BoxcarCachingAlgorithm.h:13
Isis::AbstractTreeModel::setGlobalSelection
void setGlobalSelection(bool selected, InterestingItemsFlag=AllItems)
Definition: AbstractTreeModel.cpp:483
Isis::TreeViewContent::mouseMoveEvent
void mouseMoveEvent(QMouseEvent *event)
Definition: TreeViewContent.cpp:276
Isis::AbstractTreeModel
Base class for tree models.
Definition: AbstractTreeModel.h:47
Isis::TreeViewContent::setModel
void setModel(AbstractTreeModel *someModel)
Definition: TreeViewContent.cpp:98
Isis::AbstractTreeItem::Measure
@ Measure
Definition: AbstractTreeItem.h:47
Isis::AbstractTreeItem::isSelectable
virtual bool isSelectable() const
Definition: AbstractTreeItem.cpp:141
Isis::TreeViewContent::mousePressEvent
void mousePressEvent(QMouseEvent *event)
Definition: TreeViewContent.cpp:164
Isis::TreeViewContent::keyPressEvent
void keyPressEvent(QKeyEvent *event)
Definition: TreeViewContent.cpp:308
IString.h
Isis::AbstractTreeItem::setExpanded
virtual void setExpanded(bool newState)
Definition: AbstractTreeItem.cpp:117
Isis::TreeViewContent::scrollContentsBy
void scrollContentsBy(int dx, int dy)
Definition: TreeViewContent.cpp:393
Isis::AbstractTreeItem::setSelected
virtual void setSelected(bool newState)
Definition: AbstractTreeItem.cpp:126
Isis::AbstractTreeItem::isSelected
virtual bool isSelected() const
Definition: AbstractTreeItem.cpp:136
_FILEINFO_
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:24
Isis::TreeViewContent::minimumSizeHint
QSize minimumSizeHint() const
Definition: TreeViewContent.cpp:83
AbstractTreeItem.h
Isis::AbstractTreeItem::getChildren
virtual QList< AbstractTreeItem * > getChildren() const =0
Isis::TreeViewContent::treeSelectionChanged
void treeSelectionChanged(QList< AbstractTreeItem * >)
Isis::TreeViewContent
Definition: TreeViewContent.h:36
Isis::TreeViewContent::sizeHint
QSize sizeHint() const
Definition: TreeViewContent.cpp:88
Isis::TreeViewContent::treeSelectionChanged
void treeSelectionChanged()
Isis::TreeViewContent::leaveEvent
void leaveEvent(QEvent *event)
Definition: TreeViewContent.cpp:301
Isis::IException
Isis exception class.
Definition: IException.h:91
ASSERT
#define ASSERT(x)
Definition: IsisDebug.h:134
Isis::AbstractTreeModel::isFiltering
bool isFiltering() const
Definition: AbstractTreeModel.cpp:355
IException.h
Isis::IException::Programmer
@ Programmer
This error is for when a programmer made an API call that was illegal.
Definition: IException.h:146
QPair
This is free and unencumbered software released into the public domain.
Definition: CubeIoHandler.h:23
AbstractTreeModel.h
Isis::TreeViewContent::~TreeViewContent
virtual ~TreeViewContent()
Definition: TreeViewContent.cpp:65
Isis::TreeViewContent::mouseDoubleClickEvent
void mouseDoubleClickEvent(QMouseEvent *event)
Definition: TreeViewContent.cpp:153
Isis::TreeView
Definition: TreeView.h:31
Isis::AbstractTreeItem::getPointerType
virtual InternalPointerType getPointerType() const =0
Isis::TreeViewContent::paintEvent
void paintEvent(QPaintEvent *event)
Definition: TreeViewContent.cpp:321
Isis::TreeViewContent::mouseReleaseEvent
void mouseReleaseEvent(QMouseEvent *event)
Definition: TreeViewContent.cpp:261
Isis::IString
Adds specific functionality to C++ strings.
Definition: IString.h:165
Isis::TreeViewContent::getModel
AbstractTreeModel * getModel()
Definition: TreeViewContent.cpp:93
QObject
Isis::TreeViewContent::resizeEvent
void resizeEvent(QResizeEvent *event)
Definition: TreeViewContent.cpp:385
IsisDebug.h
QAction
Isis::TreeViewContent::eventFilter
bool eventFilter(QObject *target, QEvent *event)
Definition: TreeViewContent.cpp:148
Isis::AbstractTreeItem
Base class for an item in the tree.
Definition: AbstractTreeItem.h:39
Isis::AbstractTreeModel::indexOfVisibleItem
int indexOfVisibleItem(AbstractTreeItem const *item, InterestingItemsFlag=AllItems, bool=false) const
Definition: AbstractTreeModel.cpp:308
Isis::AbstractTreeModel::getItems
QList< AbstractTreeItem * > getItems(int, int, InterestingItemsFlag=AllItems, bool=false)
Definition: AbstractTreeModel.cpp:121
Isis::AbstractTreeItem::isExpanded
virtual bool isExpanded() const
Definition: AbstractTreeItem.cpp:121
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16
Isis::TreeViewContent::TreeViewContent
TreeViewContent(QWidget *parent)
Definition: TreeViewContent.cpp:36