-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_css.cpp
More file actions
64 lines (57 loc) · 1.52 KB
/
test_css.cpp
File metadata and controls
64 lines (57 loc) · 1.52 KB
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
#include <QDebug>
#include "selectors/CssSelector.h"
#include <QObjectList>
bool should_run_test() {
return !true;
}
void run_test()
{
CssSelector pokus("[text=blabla]");
pokus.parse("QWidget#ble");
qDebug()<<"Done.";
}
QObjectList the_recursive_fn(QObjectList& list, int iteration = 2) {
if(iteration>0) {
//list.push_back(new QObject);
iteration--;
the_recursive_fn(list, iteration);
return list;
}
else {
return list;
}
}
#include <QObject>
QObjectList findObjectRecursively(QObject* parent, bool returnFirst, QObjectList& targetList) {
const QObjectList& children = parent->children();
Q_FOREACH(QObject* child, children) {
// if(satisfies(child)) {
// targetList.push_back(child);
// if(returnFirst)
// return targetList;
// }
findObjectRecursively(child, returnFirst, targetList);
if(returnFirst && targetList.size()>0) {
return targetList;
}
}
if(targetList.isEmpty())
return QObjectList();
else
return targetList;
}
#include "selectors/Selector.h"
void QLIST_craziness() {
QObject* o_top = new QObject;
QObject* child = new QObject(o_top);
child = new QObject(child);
QObjectList empty;
SelectorPtr test = Selector::parseString("\"Show\"");
findObjectRecursively(o_top, false, empty);
qDebug()<<"Pause";
delete o_top;
/*the_recursive_fn(empty, 3);
Q_FOREACH(QObject* o, empty) {
delete o;
}*/
}