-
-
Notifications
You must be signed in to change notification settings - Fork 143
/
Copy pathtablewidget.h
57 lines (45 loc) · 1.41 KB
/
tablewidget.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
#pragma once
#include <QAbstractListModel>
#include <QAbstractItemView>
#include <QWidget>
namespace Ui {
class TableWidget;
}
class TableWidget : public QWidget
{
Q_OBJECT
public:
explicit TableWidget(QWidget *parent = nullptr);
~TableWidget() override;
public:
void enableFiltering();
void setToggleFilter(bool b);
void setShowVerticalHeader(bool v);
void setAlternatingRowColors(bool b);
void setColumnHidden(int idx);
void resizeColumn(int idx);
void resizeColumnsUntil(int offset);
void moveSection(int from, int to);
void setSelectionModel(QAbstractItemView::SelectionMode mode);
void setSelectionBehavior(QAbstractItemView::SelectionBehavior behavior);
void setModel(QAbstractItemModel* model);
QAbstractItemModel* model() const;
public Q_SLOTS:
void resizeAllColumns();
protected:
bool event(QEvent* e) override;
private Q_SLOTS:
void onTableDoubleClicked(const QModelIndex& index);
void onTableClicked(const QModelIndex& index);
private:
void clearFilter();
void showFilter();
Q_SIGNALS:
void doubleClicked(const QModelIndex& index);
void clicked(const QModelIndex& index);
void resizeColumns();
private:
Ui::TableWidget *ui;
bool m_togglefilter{false};
QAction* m_actfilter;
};