Isis 3 Programmer Reference
TreeViewContent.h
1 #ifndef TreeViewContent_H
2 #define TreeViewContent_H
3 
4 
5 // parent
6 #include <QAbstractScrollArea>
7 
8 
9 class QEvent;
10 class QKeyEvent;
11 template< typename T > class QList;
12 class QMouseEvent;
13 class QPoint;
14 class QResizeEvent;
15 
16 
17 namespace Isis {
18  class AbstractTreeItem;
19  class AbstractTreeModel;
20  class TreeView;
21 
30  Q_OBJECT
31 
32  public:
33  TreeViewContent(QWidget *parent);
34  virtual ~TreeViewContent();
35  QSize minimumSizeHint() const;
36  QSize sizeHint() const;
37  AbstractTreeModel *getModel();
38  void setModel(AbstractTreeModel *someModel);
39 
40 
41  signals:
42  void treeSelectionChanged();
43  void treeSelectionChanged(QList< AbstractTreeItem * >);
44 
45 
46  public slots:
47  void refresh();
48 
49 
50  protected:
51  bool eventFilter(QObject *target, QEvent *event);
52  void keyPressEvent(QKeyEvent *event);
53  void leaveEvent(QEvent *event);
54  void mouseDoubleClickEvent(QMouseEvent *event);
55  void mouseMoveEvent(QMouseEvent *event);
56  void mousePressEvent(QMouseEvent *event);
57  void mouseReleaseEvent(QMouseEvent *event);
58  void paintEvent(QPaintEvent *event);
59  void resizeEvent(QResizeEvent *event);
60  void scrollContentsBy(int dx, int dy);
61 
62 
63  private:
64  TreeViewContent(const TreeViewContent &other);
65  TreeViewContent &operator=(const TreeViewContent &other);
66 
67 
68  private:
69  void nullify();
70  void paintItemText(QPainter *, int, QPoint, QPoint);
71  void drawCollapsedArrow(QPainter *, QRect);
72  void drawExpandedArrow(QPainter *, QRect);
73  QRect getArrowRect(AbstractTreeItem *item) const;
74 
75 
76  private slots:
77  void scrollTo(QList< AbstractTreeItem * >);
78  void scrollTo(AbstractTreeItem *);
79  void setAlternatingRowColors(bool);
80  void updateItemList();
81 
82 
83  private:
84  TreeView *m_parentView;
85  AbstractTreeModel *m_model;
87 
90 
93 
94  AbstractTreeItem *m_lastDirectlySelectedItem;
95  QList<AbstractTreeItem *> * m_lastShiftSelection;
96 
97  QPoint *m_mousePressPos;
98  int m_rowHeight;
99  int m_contentWidth;
100  bool m_alternatingRowColors;
101 
102 
103  private:
104  static const int ITEM_PADDING = 4;
105  static const int ITEM_INDENTATION = 23;
106  };
107 }
108 
109 #endif
Base class for tree models.
QPair< AbstractTreeItem *, bool > * m_pressedItem
The bool is true if the arrow in the item was pressed.
QPair< AbstractTreeItem *, bool > * m_hoveredItem
The bool is true if the mouse is hovering over the arrow.
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
Base class for an item in the tree.