On Sonntag 28 November 2010, Steve Borho wrote:
> Indeed, I found these when I started using the file, and
> checked in a fixed version here:
>
> http://bitbucket.org/tortoisehg/thg/src/tip/tortoisehg/hgqt/mo
> deltest.py
here are some more bug fixes for editable models. The patch is
against your file.
I changed the alignment checks to match
http://qt.gitorious.org/qt/qt/blobs/4.7/tests/auto/modeltest/modeltest.cpp
--
Wolfgang
--- modeltest0.py 2010-11-29 11:29:19.247958003 +0100
+++ modeltest.py 2010-11-29 11:01:20.997958008 +0100
@@ -262,10 +262,7 @@
variant = self.model.data(self.model.index(0,0,QtCore.QModelIndex()), QtCore.Qt.TextAlignmentRole)
if variant.isValid():
alignment = variant.toInt()[0]
- assert( alignment == QtCore.Qt.AlignLeft or
- alignment == QtCore.Qt.AlignRight or
- alignment == QtCore.Qt.AlignHCenter or
- alignment == QtCore.Qt.AlignJustify)
+ assert( alignment == (alignment & int(QtCore.Qt.AlignHorizontal_Mask | QtCore.Qt.AlignVertical_Mask)))
# General Purpose roles that should return a QColor
variant = self.model.data(self.model.index(0,0,QtCore.QModelIndex()), QtCore.Qt.BackgroundColorRole)
@@ -313,7 +310,7 @@
c = self.insert.pop()
assert(c['parent'] == parent)
assert(c['oldSize'] + (end - start + 1) == self.model.rowCount(parent))
- assert(c['last'] == self.model.data(model.index(start-1, 0, c['parent'])))
+ assert(c['last'] == self.model.data(self.model.index(start-1, 0, c['parent'])))
# if c['next'] != self.model.data(model.index(end+1, 0, c['parent'])):
# qDebug << start << end
@@ -330,19 +327,19 @@
c = {}
c['parent'] = parent
c['oldSize'] = self.model.rowCount(parent)
- c['last'] = self.model.data(model.index(start-1, 0, parent))
- c['next'] = self.model.data(model.index(end+1, 0, parent))
- remove.append(c)
+ c['last'] = self.model.data(self.model.index(start-1, 0, parent))
+ c['next'] = self.model.data(self.model.index(end+1, 0, parent))
+ self.remove.append(c)
def rowsRemoved(self, parent, start, end):
"""
Confirm that what was said was going to happen actually did
"""
- c = remove.pop()
+ c = self.remove.pop()
assert(c['parent'] == parent)
assert(c['oldSize'] - (end - start + 1) == self.model.rowCount(parent))
- assert(c['last'] == self.model.data(model.index(start-1, 0, c['parent'])))
- assert(c['next'] == self.model.data(model.index(start, 0, c['parent'])))
+ assert(c['last'] == self.model.data(self.model.index(start-1, 0, c['parent'])))
+ assert(c['next'] == self.model.data(self.model.index(start, 0, c['parent'])))
def checkChildren(self, parent, depth = 0):
"""
_______________________________________________
PyQt mailing list [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt