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