blob: 0db8873e78e5d0dcd2c13eda29eee5f666791a0d (
plain)
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
|
/*
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version
2 of the License, or (at your option) any later version.
*/
#ifndef SERIESTREEWIDGET_H
#define SERIESTREEWIDGET_H
#include <QWidget>
#include <QTreeView>
#include <QSortFilterProxyModel>
class QLineEdit;
class QPushButton;
class QSortFilterProxyModel;
class SeriesTreeModel;
class SeriesTreeView;
class SeriesTreeSortModel;
class SeriesTreeWidget : public QWidget {
Q_OBJECT
public:
explicit SeriesTreeWidget(QWidget *parent = 0);
SeriesTreeView *seriesTree() { return mView; }
QModelIndexList mapToSource(const QModelIndexList &indexes) const;
QModelIndex mapToSource(const QModelIndex &index) const;
public slots:
void newSeries();
void deleteFromSeries();
void readSettings();
void writeSettings();
void expandCurrent();
private slots:
void filter();
void resort();
void itemExpanded(const QModelIndex &);
void itemCollaped(const QModelIndex &);
private:
QLineEdit *mFilterEdit;
QPushButton *mFilter;
SeriesTreeView *mView;
SeriesTreeSortModel *mProxy;
SeriesTreeModel *mModel;
QStringList mExpandedItems;
};
class SeriesTreeView : public QTreeView {
Q_OBJECT
public:
explicit SeriesTreeView(QWidget *parent = 0);
protected:
virtual void contextMenuEvent(QContextMenuEvent *e);
};
class SeriesTreeSortModel : public QSortFilterProxyModel {
Q_OBJECT
public:
SeriesTreeSortModel(QObject *parent = 0);
~SeriesTreeSortModel() {}
protected:
virtual bool lessThan(const QModelIndex &left, const QModelIndex &right) const;
};
#endif
|