Adds a hash function to QTreeWidgetItem objects.
A "hashable" unit test was added as well. Reviewed by Anderson Lizardo <anderson.lizardo@openbossa.org> Reviewed by Bruno Araújo <bruno.araujo@openbossa.org>
This commit is contained in:
parent
c424162a03
commit
290d773b32
2 changed files with 19 additions and 1 deletions
|
|
@ -2856,7 +2856,7 @@
|
||||||
</modify-argument>
|
</modify-argument>
|
||||||
</modify-function>
|
</modify-function>
|
||||||
</object-type>
|
</object-type>
|
||||||
<object-type name="QTreeWidgetItem" >
|
<object-type name="QTreeWidgetItem" hash-function="qHash">
|
||||||
<modify-function signature="operator<(QTreeWidgetItem)const">
|
<modify-function signature="operator<(QTreeWidgetItem)const">
|
||||||
<modify-argument index="1" invalidate-after-use="yes"/>
|
<modify-argument index="1" invalidate-after-use="yes"/>
|
||||||
</modify-function>
|
</modify-function>
|
||||||
|
|
|
||||||
18
tests/qtgui/hashabletype_test.py
Normal file
18
tests/qtgui/hashabletype_test.py
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
'''Test cases for __hash__'''
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
from PySide.QtGui import QTreeWidgetItem
|
||||||
|
from helper import UsesQApplication
|
||||||
|
|
||||||
|
class HashableTest(UsesQApplication):
|
||||||
|
|
||||||
|
def testQTreeWidgetItemHash(self):
|
||||||
|
h = {}
|
||||||
|
obj = QTreeWidgetItem()
|
||||||
|
h[obj] = 2
|
||||||
|
self.assert_(h.get(obj), 2)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue