/
bigtable.h
69 lines (55 loc) · 1.9 KB
/
bigtable.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//--------------------------------------------------------------------------//
/// Copyright (c) 2017 by Milos Tosic. All Rights Reserved. ///
/// License: http://www.opensource.org/licenses/BSD-2-Clause ///
//--------------------------------------------------------------------------//
#ifndef __RTM_MTUNER_BIGTABLE_H__
#define __RTM_MTUNER_BIGTABLE_H__
#include <mtuner/.qt/qt_ui/bigTable_ui.h>
class BigTableTableWidget;
class BigTableSource
{
public:
virtual QStringList getHeaderInfo(int32_t& _sortCol, Qt::SortOrder& _sortOrder) = 0;
virtual uint32_t getNumberOfRows() = 0;
virtual QString getItem(uint32_t _index, int32_t _column, QColor* _color, bool* _setColor) = 0;
virtual void getItem(uint32_t _index, void**) = 0;
virtual uint32_t getItemIndex(void* _item) = 0;
virtual void sortColumn(uint32_t _colIndex, Qt::SortOrder _order) = 0;
};
class BigTable : public QWidget
{
Q_OBJECT
private:
QStringList m_header;
BigTableTableWidget* m_tree;
QScrollBar* m_scroll;
BigTableSource* m_source;
int32_t m_numColumns;
int32_t m_selectedRows;
int32_t m_firstVisible;
int32_t m_visibleRows;
public:
BigTable(QWidget* _parent = 0, Qt::WindowFlags _flags = 0);
void changeEvent(QEvent* _event);
void setSource(BigTableSource* _src);
void select(void* _item);
void updateTable();
void resetView();
void ensureSelectionVisible();
/// QWidget
void resizeEvent(QResizeEvent* _event);
void wheelEvent(QWheelEvent* _event);
void keyPressEvent(QKeyEvent* _event);
QHeaderView* getHeader() { return m_tree->horizontalHeader(); }
Q_SIGNALS:
void itemSelected(void*);
void itemRightClicked(void*, const QPoint&);
public Q_SLOTS:
void scroll(int);
void rowSelected(QTableWidgetItem*);
void rowRightClick(QTableWidgetItem*, const QPoint&);
void sortSelection(int, Qt::SortOrder);
private:
Ui::BigTableWidget ui;
};
#endif // __RTM_MTUNER_BIGTABLE_H__