Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Pretty printers for Qt 5.0.0



  • Hi
    I developed a set of pretty printers for qt 4.8.3 that worked pretty well.
    When I come to use them with Qt 5.0.0 they are not working

    For example the printer for QVector looks like this
    @
    class QVectorPrinter:
    "Print a QVector"

    class _iterator:
        def __init__(self, nodetype, d, p):
            self.nodetype = nodetype
            self.d = d
            self.p = p
            self.count = 0
    
        def __iter__(self):
            return self
    
        def next(self):
            if self.count >= self.p['size']:
                raise StopIteration
            count = self.count
    
            self.count = self.count + 1
            return ('[%d]' % count, self.p['array'][count])
    
    def __init__(self, val, container):
        self.val = val
        self.container = container
        self.itype = self.val.type.template_argument(0)
    
    def children(self):
        return self._iterator(self.itype, self.val['d'], self.val['p'])
    
    def to_string(self):
        if self.val['d']['size'] == 0:
            empty = "empty "
        else:
            empty = ""
    
        return "%s%s<%s>" % ( empty, self.container, self.itype )
    

    @

    When I try to print the value of a vector it reports that there is no member called 'p'

    When I look at the source for QVector it has obviously changed from 4.8.3 but I cannot see how to print the values

    Can anyone give me some pointers on this?

    Thanks


Log in to reply