aboutsummaryrefslogtreecommitdiffstats
path: root/doc/codesnippets/doc/src/snippets/code/src_script_qscriptvalueiterator.cpp
blob: a8bb1f3fd99a9234df38e888013a3cbfcf894d26 (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
//! [0]
object = QScriptValue()
...
it = QScriptValueIterator(object)
while it.hasNext():
    it.next()
    print "%s:%s" % (it.name(), it.value().toString())
//! [0]


//! [1]
QScriptValue obj = ... // the object to iterate over
while obj.isObject():
    it = QScriptValueIterator(obj)
    while it.hasNext():
        it.next()
        print it.name()
    obj = obj.prototype()
//! [1]


//! [2]
while it.hasNext():
    it.next()
    if it.flags() & QScriptValue::SkipInEnumeration:
        continue
    print "found enumerated property: %s" % it.name()
//! [2]