Isis Developer Reference
TableViewHeader.h
Go to the documentation of this file.
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::TableColumnList::size
int size() const
Definition: TableColumnList.cpp:166
TableColumn.h
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
QList
This is free and unencumbered software released into the public domain.
Definition: BoxcarCachingAlgorithm.h:13
Isis::TableViewHeader::mousePressEvent
void mousePressEvent(QMouseEvent *event)
Overrides QWidget::mousePressEvent.
Definition: TableViewHeader.cpp:216
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::columnResized
void columnResized(bool lastColumn)
Isis::TableColumn::EDGE_WIDTH
static const int EDGE_WIDTH
Definition: TableColumn.h:48
AbstractTableModel.h
Isis::TableColumn
Definition: TableColumn.h:26
Isis::TableColumn::setWidth
void setWidth(int)
Definition: TableColumn.cpp:85
Isis::TableViewHeader::updateRebuildProgressRange
void updateRebuildProgressRange(int min, int max)
Updates the range of the rebuild progress.
Definition: TableViewHeader.cpp:666
Isis::TableColumnList::getVisibleColumns
TableColumnList getVisibleColumns()
Definition: TableColumnList.cpp:204
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
Isis::AbstractTableModel::sortingOn
virtual bool sortingOn() const
Definition: AbstractTableModel.cpp:149
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::TableColumn::sortAscending
bool sortAscending() const
Definition: TableColumn.cpp:101
Isis::TableViewHeader::~TableViewHeader
virtual ~TableViewHeader()
Destructor.
Definition: TableViewHeader.cpp:72
Isis::TableViewHeader::TableViewHeader
TableViewHeader(AbstractTableModel *someModel)
Constructor.
Definition: TableViewHeader.cpp:41
TableView.h
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::raiseToTop
void raiseToTop(TableColumn *col)
Definition: TableColumnList.cpp:153
Isis::TableColumnList
Definition: TableColumnList.h:30
Isis::TableViewHeader::updateRebuildProgress
void updateRebuildProgress(int newProgress)
Updates the current rebuild progress value.
Definition: TableViewHeader.cpp:654
Isis::AbstractTableModel::getColumns
virtual TableColumnList * getColumns()
Definition: AbstractTableModel.cpp:154
Isis::TableViewHeader::sortingEnabled
void sortingEnabled(bool)
Isis::TableViewHeader::setColumns
virtual void setColumns(TableColumnList *)
Sets the column list.
Definition: TableViewHeader.cpp:82
Isis::TableColumn::getTitle
QString getTitle() const
Definition: TableColumn.cpp:49
ASSERT
#define ASSERT(x)
Definition: IsisDebug.h:134
Isis::TableViewHeader::requestedColumnSelection
void requestedColumnSelection(int columnNum, bool select)
Isis::TableViewHeader::updateSortProgressRange
void updateSortProgressRange(int min, int max)
Updates the range of the sort progress.
Definition: TableViewHeader.cpp:690
AbstractTreeModel.h
TableViewHeader.h
Isis::TableColumn::setSortAscending
void setSortAscending(bool ascending)
Definition: TableColumn.cpp:106
Isis::TableColumnList::getSortingOrder
QList< TableColumn * > getSortingOrder()
Definition: TableColumnList.cpp:241
IsisDebug.h
TableColumnList.h
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16
Isis::TableViewHeader::requestedGlobalSelection
void requestedGlobalSelection(bool select)