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
16class QEvent;
17class QKeyEvent;
18template< typename T > class QList;
19class QMouseEvent;
20class QPoint;
21class QResizeEvent;
22
23
24namespace 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:
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;
93 QList< AbstractTreeItem * > * m_items;
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
Base class for an item in the tree.
Definition AbstractTreeItem.h:39
Base class for tree models.
Definition AbstractTreeModel.h:48
Definition TreeViewContent.h:36
virtual ~TreeViewContent()
Definition TreeViewContent.cpp:62
void paintEvent(QPaintEvent *event)
Definition TreeViewContent.cpp:318
TreeViewContent(QWidget *parent)
Definition TreeViewContent.cpp:34
QSize minimumSizeHint() const
Definition TreeViewContent.cpp:80
void mousePressEvent(QMouseEvent *event)
Definition TreeViewContent.cpp:161
void resizeEvent(QResizeEvent *event)
Definition TreeViewContent.cpp:381
void mouseDoubleClickEvent(QMouseEvent *event)
Definition TreeViewContent.cpp:150
void treeSelectionChanged(QList< AbstractTreeItem * >)
void mouseMoveEvent(QMouseEvent *event)
Definition TreeViewContent.cpp:273
bool eventFilter(QObject *target, QEvent *event)
Definition TreeViewContent.cpp:145
void setModel(AbstractTreeModel *someModel)
Definition TreeViewContent.cpp:95
void scrollContentsBy(int dx, int dy)
Definition TreeViewContent.cpp:389
void keyPressEvent(QKeyEvent *event)
Definition TreeViewContent.cpp:305
AbstractTreeModel * getModel()
Definition TreeViewContent.cpp:90
void leaveEvent(QEvent *event)
Definition TreeViewContent.cpp:298
QSize sizeHint() const
Definition TreeViewContent.cpp:85
void mouseReleaseEvent(QMouseEvent *event)
Definition TreeViewContent.cpp:258
void refresh()
Definition TreeViewContent.cpp:126
Definition TreeView.h:31
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