-
Notifications
You must be signed in to change notification settings - Fork 3
/
EventTreeWidget.h
90 lines (63 loc) · 2.16 KB
/
EventTreeWidget.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#ifndef EVENT_TREE_WIDGET
#define EVENT_TREE_WIDGET
#include <QTreeWidget>
#include <QTreeWidgetItem>
class QMenu;
class Event;
/**************************************************************************
* This wrapper class takes care of the tedium of the generic MVC nonsense,
* as well as QVariants.
**************************************************************************/
class EventTreeWidgetItem : public QTreeWidgetItem {
public:
static const char *S_datetimeSec_fmt,
*S_datetimeMin_fmt;
enum {
TYPE_COL,
TIMESTAMP_COL,
N_COLS
};
EventTreeWidgetItem(int64_t prj_id);
~EventTreeWidgetItem();
/* Eliminate default copy constructor and assignment operator */
EventTreeWidgetItem(const EventTreeWidgetItem&)= delete;
EventTreeWidgetItem& operator=(const EventTreeWidgetItem&)= delete;
EventTreeWidgetItem* child(int ndx);
Event* getEvent() const;
void refresh();
int64_t event_id() const;
void setText(int column, const QString &text);
};
/**************************************************************************
* Wrap the QTreeWidget class to customize for our needs.
**************************************************************************/
class EventTreeWidget : public QTreeWidget {
Q_OBJECT
public:
EventTreeWidget(QWidget *parent);
~EventTreeWidget();
/* Eliminate default copy constructor and assignment operator */
EventTreeWidget(const EventTreeWidget&)= delete;
EventTreeWidget& operator=(const EventTreeWidget&)= delete;
EventTreeWidgetItem* itemAt(const QPoint &p) const;
EventTreeWidgetItem* findItem(int64_t event_id);
void setProject(int64_t prj_id);
signals:
private slots:
void moveEvents();
void showEventCtxtMenu(const QPoint&);
void editedEvent(QTreeWidgetItem *item, int col);
void editMenuEventType();
void editMenuEventTimestamp();
void deleteMenuEvent();
void event_insert(int64_t);
void event_update(int64_t);
void event_remove(int64_t);
private:
EventTreeWidgetItem* slctnIndex2item(int ndx);
int64_t _project_id;
bool _ignoreEditedEvent;
QList<QTreeWidgetItem*> _slctn_lst;
QMenu *_menu;
};
#endif