Isis 3 Programmer Reference
TableViewHeader.h
1 #ifndef TableViewHeader_H
2 #define TableViewHeader_H
3 
4 #include <QWidget>
5 
6 class QMouseEvent;
7 class QPainter;
8 class QPaintEvent;
9 class QSize;
10 class QStringList;
11 template<typename T> class QList;
12 
13 
14 namespace Isis {
15  class AbstractTableModel;
16  class TableColumnList;
17 
26  class TableViewHeader : public QWidget {
27 
28  Q_OBJECT
29 
30  public:
31  explicit TableViewHeader(AbstractTableModel *someModel);
32  virtual ~TableViewHeader();
33  virtual void setColumns(TableColumnList *);
34  QSize minimumSizeHint() const;
35  QSize sizeHint() const;
36 
37  void setModel(AbstractTableModel *someModel);
38 
39 
40  signals:
41  void columnResized(bool lastColumn);
42  void requestedGlobalSelection(bool select);
43  void requestedColumnSelection(int columnNum, bool select);
44  void sortingEnabled(bool);
45 
46 
47  public slots:
48  void handleFilterCountsChanged(int visibleTopLevelItemCount,
49  int topLevelItemCount);
50  void updateHeaderOffset(int);
51  void updateFilterProgress(int newProgress);
52  void updateFilterProgressRange(int min, int max);
53  void updateRebuildProgress(int newProgress);
54  void updateRebuildProgressRange(int min, int max);
55  void updateSortProgress(int newProgress);
56  void updateSortProgressRange(int min, int max);
57 
58 
59  protected:
60  void mouseMoveEvent(QMouseEvent *event);
61  void mousePressEvent(QMouseEvent *event);
62  void mouseReleaseEvent(QMouseEvent *event);
63  void paintEvent(QPaintEvent *event);
64 
65 
66  private: // methods
67  TableViewHeader(const TableViewHeader &other);
68  TableViewHeader &operator=(TableViewHeader other);
69  void nullify();
70  QRect getColumnRect(int column) const;
71  int getMousedColumn(QPoint mousePos);
72  int getMousedColumnEdge(QPoint mousePos);
73  bool mouseAtResizableColumnEdge(QPoint mousePos);
74  void paintHeader(QPainter *painter, int rowheight);
75  void paintProgress(QPainter *painter, const QRect &rect, int min,
76  int max, int value, bool over100);
77  QRect getSortingPriorityRect(int visColIndex);
78  QRect getSortingArrowRect(int visColIndex);
79 
80 
81  private: // data
82  TableColumnList *m_columns;
83  int m_horizontalOffset;
84  int m_filterProgress;
85  int m_filterProgressMin;
86  int m_filterProgressMax;
87  int m_rebuildProgress;
88  int m_rebuildProgressMin;
89  int m_rebuildProgressMax;
90  int m_sortProgress;
91  int m_sortProgressMin;
92  int m_sortProgressMax;
93 
94  int m_visibleCount;
95  int m_totalCount;
96 
97  int m_clickedColumnEdge;
98  int m_clickedColumn;
99 
100  static int const SORT_ARROW_MARGIN = 10;
101  int ARROW_HEIGHT;
102  int ARROW_WIDTH;
103 
104  AbstractTableModel *m_model;
105  };
106 }
107 
108 
109 #endif
void paintHeader(QPainter *painter, int rowheight)
Repaints the header.
int getMousedColumn(QPoint mousePos)
Returns the column under the mouse.
void updateFilterProgress(int newProgress)
Updates the current filter progress value.
void updateFilterProgressRange(int min, int max)
Updates the range of the filter progress.
QSize minimumSizeHint() const
Returns the minimum size based on the font.
void handleFilterCountsChanged(int visibleTopLevelItemCount, int topLevelItemCount)
Updates the visible columns, and geometry when the filter count changes.
void updateRebuildProgressRange(int min, int max)
Updates the range of the rebuild progress.
void updateHeaderOffset(int)
Updates the header offset.
void nullify()
Sets all the member variables to NULL.
void mousePressEvent(QMouseEvent *event)
Overrides QWidget::mousePressEvent.
int getMousedColumnEdge(QPoint mousePos)
Returns the edge of the column under the mouse.
void setModel(AbstractTableModel *someModel)
Connects the table model to the functions that handle changes.
bool mouseAtResizableColumnEdge(QPoint mousePos)
Returns if the mouse is at the edge of a resizeable column.
virtual ~TableViewHeader()
Destructor.
Translates the tree model into a table model.
void updateSortProgressRange(int min, int max)
Updates the range of the sort progress.
QRect getColumnRect(int column) const
Returns the visible column rectangle.
void mouseMoveEvent(QMouseEvent *event)
Overrides QWidget::mouseMoveEvent.
virtual void setColumns(TableColumnList *)
Sets the column list.
void updateSortProgress(int newProgress)
Updates the current sort progress value.
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
QSize sizeHint() const
Returns the minimum size based on the font.
void updateRebuildProgress(int newProgress)
Updates the current rebuild progress value.
void mouseReleaseEvent(QMouseEvent *event)
Overrides QWidget::mouseReleaseEvent.
void paintProgress(QPainter *painter, const QRect &rect, int min, int max, int value, bool over100)
Updates the progress bar.
TableViewHeader(AbstractTableModel *someModel)
Constructor.
void paintEvent(QPaintEvent *event)
Repaints the header.