Added it as bug /688 in bugzilla.
/On 16.02.2011 15:24, Bjørn Helge Kjøsnes wrote:
I have been trying to extract information from a QTextEdit object
using code, but run in to problems iterating the elements inside a
QTextDocument. It seams like there is no way to get to the next
element after starting iterating using the rootFrame.begin() method.
If you examine the metgod list using dir(titer), you will find that it
is missing the __iadd__ and __isub__ methods in PySide. It is missing
in the documentation as well.
http://www.pyside.org/docs/pyside/PySide/QtGui/QTextFrame.iterator.html is
missing __iadd__ and __isub__
http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qtextframe-iterator.html
is having both a __iadd__ and an __isub__
I have attached a example that works fine in PyQt4 but not in PySide.
Here is the method not working:
def rebuildtree(self):
self.rtree.clear()
tdoc = self.redit.document()
rframe = tdoc.rootFrame()
titer = rframe.begin()
while not titer.atEnd():
tb = titer.currentBlock()
if tb:
treeitem = QtGui.QTreeWidgetItem(self.rtree)
scontent = 'a text block (%s)' % tb.text()
treeitem.setText(0, scontent)
else:
tf = titer.currentFrame()
treeitem = QtGui.QTreeWidgetItem(self.rtree)
treeitem.setText(0, 'a frame')
res = dir(titer) # This one is missing the __iadd__ in PySide
titer.__iadd__(1) #This can be used in PyQt4 but not found
in PySide
Is this a bug or have I missed out on another smarter way of getting
the next element using the iterator.
Thanks,
Bjorn Helge Kjosnes
_______________________________________________
PySide mailing list
PySide@lists.openbossa.org
http://lists.openbossa.org/listinfo/pyside