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 
14 class QMouseEvent;
15 class QPainter;
16 class QPaintEvent;
17 class QSize;
18 class QStringList;
19 template<typename T> class QList;
20 
21 
22 namespace 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
QWidget
Isis::TableViewHeader::updateFilterProgressRange
void updateFilterProgressRange(int min, int max)
Updates the range of the filter progress.
Definition: TableViewHeader.cpp:642
Isis::TableViewHeader
Definition: TableViewHeader.h:34
Isis::TableViewHeader::mousePressEvent
void mousePressEvent(QMouseEvent *event)
Overrides QWidget::mousePressEvent.
Definition: TableViewHeader.cpp:216
QList
This is free and unencumbered software released into the public domain.
Definition: BoxcarCachingAlgorithm.h:13
Isis::TableViewHeader::sizeHint
QSize sizeHint() const
Returns the minimum size based on the font.
Definition: TableViewHeader.cpp:106
Isis::TableViewHeader::mouseMoveEvent
void mouseMoveEvent(QMouseEvent *event)
Overrides QWidget::mouseMoveEvent.
Definition: TableViewHeader.cpp:249
Isis::TableViewHeader::updateRebuildProgressRange
void updateRebuildProgressRange(int min, int max)
Updates the range of the rebuild progress.
Definition: TableViewHeader.cpp:666
Isis::TableViewHeader::setModel
void setModel(AbstractTableModel *someModel)
Connects the table model to the functions that handle changes.
Definition: TableViewHeader.cpp:116
Isis::AbstractTableModel
Translates the tree model into a table model.
Definition: AbstractTableModel.h:48
QStringList
Isis::TableViewHeader::mouseReleaseEvent
void mouseReleaseEvent(QMouseEvent *event)
Overrides QWidget::mouseReleaseEvent.
Definition: TableViewHeader.cpp:285
Isis::TableViewHeader::updateHeaderOffset
void updateHeaderOffset(int)
Updates the header offset.
Definition: TableViewHeader.cpp:205
Isis::TableViewHeader::paintHeader
void paintHeader(QPainter *painter, int rowheight)
Repaints the header.
Definition: TableViewHeader.cpp:464
Isis::TableViewHeader::~TableViewHeader
virtual ~TableViewHeader()
Destructor.
Definition: TableViewHeader.cpp:72
Isis::TableViewHeader::paintProgress
void paintProgress(QPainter *painter, const QRect &rect, int min, int max, int value, bool over100)
Updates the progress bar.
Definition: TableViewHeader.cpp:607
Isis::TableViewHeader::TableViewHeader
TableViewHeader(AbstractTableModel *someModel)
Constructor.
Definition: TableViewHeader.cpp:41
Isis::TableViewHeader::nullify
void nullify()
Sets all the member variables to NULL.
Definition: TableViewHeader.cpp:343
Isis::TableViewHeader::getMousedColumn
int getMousedColumn(QPoint mousePos)
Returns the column under the mouse.
Definition: TableViewHeader.cpp:382
Isis::TableViewHeader::mouseAtResizableColumnEdge
bool mouseAtResizableColumnEdge(QPoint mousePos)
Returns if the mouse is at the edge of a resizeable column.
Definition: TableViewHeader.cpp:431
Isis::TableViewHeader::updateFilterProgress
void updateFilterProgress(int newProgress)
Updates the current filter progress value.
Definition: TableViewHeader.cpp:630
Isis::TableViewHeader::paintEvent
void paintEvent(QPaintEvent *event)
Repaints the header.
Definition: TableViewHeader.cpp:325
Isis::TableViewHeader::updateSortProgress
void updateSortProgress(int newProgress)
Updates the current sort progress value.
Definition: TableViewHeader.cpp:678
Isis::TableViewHeader::minimumSizeHint
QSize minimumSizeHint() const
Returns the minimum size based on the font.
Definition: TableViewHeader.cpp:92
Isis::TableViewHeader::handleFilterCountsChanged
void handleFilterCountsChanged(int visibleTopLevelItemCount, int topLevelItemCount)
Updates the visible columns, and geometry when the filter count changes.
Definition: TableViewHeader.cpp:179
Isis::TableColumnList
Definition: TableColumnList.h:30
Isis::TableViewHeader::updateRebuildProgress
void updateRebuildProgress(int newProgress)
Updates the current rebuild progress value.
Definition: TableViewHeader.cpp:654
Isis::TableViewHeader::getColumnRect
QRect getColumnRect(int column) const
Returns the visible column rectangle.
Definition: TableViewHeader.cpp:356
Isis::TableViewHeader::setColumns
virtual void setColumns(TableColumnList *)
Sets the column list.
Definition: TableViewHeader.cpp:82
Isis::TableViewHeader::updateSortProgressRange
void updateSortProgressRange(int min, int max)
Updates the range of the sort progress.
Definition: TableViewHeader.cpp:690
Isis::TableViewHeader::getMousedColumnEdge
int getMousedColumnEdge(QPoint mousePos)
Returns the edge of the column under the mouse.
Definition: TableViewHeader.cpp:404
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16