-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswftPipelineLeafListView.h
171 lines (131 loc) · 4.17 KB
/
swftPipelineLeafListView.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
#ifndef SWFTPIPELINELEAFLISTVIEW_H
#define SWFTPIPELINELEAFLISTVIEW_H
#include "pqWidgetsModule.h"
#include "pqFlatTreeView.h"
#include "pqComponentsModule.h"
#include <QModelIndex>
#include <QStyleOptionViewItem>
#include <QAbstractItemModel>
#include <QPersistentModelIndex>
#include <QFilterTreeProxyModel.h>
#include <QSortFilterProxyModel>
class pqPipelineModel;
class swftPipelineLeafListViewInternal;
class pqPipelineAnnotationFilterModel;
class pqPipelineSource;
class pqView;
class vtkSession;
//================================================
class swftPipelineLeafListViewItem
{
public:
swftPipelineLeafListViewItem()
: Children(), Index()
{
this->Parent = NULL;
this->itemSelected = false;
this->Parent = 0;
this->ContentsY = 0;
this->Height = 0;
this->Indent = 0;
this->Expandable = false;
this->Expanded = false;
this->itemSelected = false;
this->HasChildren = false;
}
~swftPipelineLeafListViewItem()
{
//cleanup children
QList<swftPipelineLeafListViewItem *>::Iterator iter = this->Children.begin();
for( ; iter != this->Children.end(); ++ iter)
{
delete *iter;
}
this->Children.clear();
}
public:
swftPipelineLeafListViewItem *Parent;
QList<swftPipelineLeafListViewItem *> Children;
QPersistentModelIndex Index;
int ContentsY;
int Height;
int Indent;
bool Expandable;
bool Expanded;
bool itemSelected;
QString name;
QStringList tags;
bool HasChildren;
void parseTags()
{
QStringList temp = this->name.split( "}");
QStringList temp2;
//strip off tags from pipeline name
//rename the object to the stripped version
if(temp.size() > 0)
{
temp2 = temp[0].split("{");
if(temp.size() > 1)
{
name = temp[1];
}
}
//parse the tags on the name, and store them in object tags list.
if(temp2.size() >= 2)
{
this->tags = temp2[1].split(",");
this->tags.removeAll(" ");
}
// for(int x=0; x < this->tags.size(); x++)
// {
// std::cout << "tag " << x << ": " << this->tags[x].toAscii().data() << std::endl;
// }
}
};
//====================================================
class swftPipelineLeafListViewInternal
{
public:
swftPipelineLeafListViewInternal()
: ShfitStart(), Index(), KeySearch()
{
this->Editor = 0;
}
~swftPipelineLeafListViewInternal() {}
QPersistentModelIndex ShfitStart;
QPersistentModelIndex Index;
QString KeySearch;
QWidget *Editor;
};
//====================================================
class swftPipelineLeafListViewItemRows: public QList<int> {};
//====================================================
class swftPipelineLeafListView : public QObject
{
Q_OBJECT
typedef QObject Superclass;
public:
explicit swftPipelineLeafListView(QAbstractItemModel *model = 0, QWidget *parent = 0);
void setModel(QAbstractItemModel *model);
void setRootIndex(const QModelIndex &index);
void addChildItems(swftPipelineLeafListViewItem *root, int paraentChildCount);
const swftPipelineLeafListViewItem* getRoot() const {return this->Root;}
QList<swftPipelineLeafListViewItem *> nodeList;
signals:
public slots:
protected slots:
void updateData(const QModelIndex &topLeft, const QModelIndex &bottomRight);
protected:
void resetRoot();
swftPipelineLeafListViewItem *Root;
swftPipelineLeafListViewInternal *Internal;
swftPipelineLeafListViewItem* getItem(const QModelIndex &index) const;
swftPipelineLeafListViewItem* getItem(const swftPipelineLeafListViewItemRows &rowList) const;
bool getIndexRowList(const QModelIndex &index, swftPipelineLeafListViewItemRows &rowList) const;
const QModelIndex pipelineModelIndex(const QModelIndex & index) const;
bool itemIsDisplayed(const QModelIndex &index_);
const pqPipelineModel* getPipelineModel(const QModelIndex &index) const;
private:
QAbstractItemModel *Model;
};
#endif // SWFTPIPELINELEAFLISTVIEW_H