Isis 3 Programmer Reference
TreeViewContent.h
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;
44  AbstractTreeModel *getModel();
45  void setModel(AbstractTreeModel *someModel);
46 
47 
48  signals:
49  void treeSelectionChanged();
50  void treeSelectionChanged(QList< AbstractTreeItem * >);
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 
97 
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
QWidget
QList
This is free and unencumbered software released into the public domain.
Definition: BoxcarCachingAlgorithm.h:13
Isis::AbstractTreeModel
Base class for tree models.
Definition: AbstractTreeModel.h:47
Isis::TreeViewContent::m_hoveredItem
QPair< AbstractTreeItem *, bool > * m_hoveredItem
The bool is true if the mouse is hovering over the arrow.
Definition: TreeViewContent.h:99
Isis::TreeViewContent
Definition: TreeViewContent.h:36
Isis::TreeViewContent::m_pressedItem
QPair< AbstractTreeItem *, bool > * m_pressedItem
The bool is true if the arrow in the item was pressed.
Definition: TreeViewContent.h:96
QPair
This is free and unencumbered software released into the public domain.
Definition: CubeIoHandler.h:23
Isis::TreeView
Definition: TreeView.h:31
QObject
Isis::AbstractTreeItem
Base class for an item in the tree.
Definition: AbstractTreeItem.h:39
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16