diff options
author | Hugo Parente Lima <hugo.pl@gmail.com> | 2010-12-29 18:57:58 -0200 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:48:06 -0300 |
commit | 9b02c46c03a3e246146ccd5b63fda8cb0335aac7 (patch) | |
tree | cf7a335f060863eb3b31a63ac5ffb66e705a5aeb | |
parent | ecb060f85c3de21b6f2e6ea94417685307252791 (diff) |
Fix bug#493 - "__eq__ and friends not implemented for QKeyEvent == QKeySequence"
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
Lauro Moura <lauro.neto@openbossa.org>
-rw-r--r-- | PySide/QtGui/typesystem_gui_common.xml | 9 | ||||
-rw-r--r-- | tests/QtGui/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/QtGui/bug_493.py | 21 |
3 files changed, 29 insertions, 2 deletions
diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index 2998c59e5..be38ca91c 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -128,7 +128,6 @@ <rejection class="QBrush" function-name="cleanUp"/> <rejection class="QFont" enum-name="ResolveProperties"/> <rejection class="QMotifStyle" field-name="focus"/> - <rejection class="QKeyEvent" function-name="operator=="/> <rejection class="QPictureIO" function-name="defineIOHandler"/> <rejection class="QPolygon" function-name="putPoints"/> <rejection class="QPolygon" function-name="setPoints"/> @@ -2427,7 +2426,13 @@ <object-type name="QInputEvent" copyable="false"> <modify-function signature="modifiers()const" access="non-final"/> </object-type> - <object-type name="QKeyEvent" copyable= "false" polymorphic-id-expression="%1->type() == QEvent::KeyPress || %1->type() == QEvent::KeyRelease"/> + <object-type name="QKeyEvent" copyable= "false" polymorphic-id-expression="%1->type() == QEvent::KeyPress || %1->type() == QEvent::KeyRelease"> + <add-function signature="operator!=(QKeySequence::StandardKey)"> + <inject-code class="target"> + %PYARG_0 = %CONVERTTOPYTHON[bool](!(&%CPPSELF == %1)); + </inject-code> + </add-function> + </object-type> <object-type name="QMouseEvent" copyable= "false" polymorphic-id-expression="%1->type() == QEvent::MouseButtonDblClick || %1->type() == QEvent::MouseButtonPress || %1->type() == QEvent::MouseButtonRelease || %1->type() == QEvent::MouseMove"/> <object-type name="QPaintEvent" copyable= "false" polymorphic-id-expression="%1->type() == QEvent::Paint"/> <object-type name="QAccessibleEvent" polymorphic-id-expression="%1->type() == QEvent::AccessibilityDescription || %1->type() == QEvent::AccessibilityHelp"/> diff --git a/tests/QtGui/CMakeLists.txt b/tests/QtGui/CMakeLists.txt index 0cd9ac271..65b10e81f 100644 --- a/tests/QtGui/CMakeLists.txt +++ b/tests/QtGui/CMakeLists.txt @@ -18,6 +18,7 @@ PYSIDE_TEST(bug_430.py) PYSIDE_TEST(bug_433.py) PYSIDE_TEST(bug_467.py) PYSIDE_TEST(bug_480.py) +PYSIDE_TEST(bug_493.py) PYSIDE_TEST(bug_500.py) PYSIDE_TEST(bug_512.py) PYSIDE_TEST(bug_525.py) diff --git a/tests/QtGui/bug_493.py b/tests/QtGui/bug_493.py new file mode 100644 index 000000000..bf19fa779 --- /dev/null +++ b/tests/QtGui/bug_493.py @@ -0,0 +1,21 @@ +from PySide.QtCore import * +from PySide.QtGui import * +import unittest + + +class TestBug569(unittest.TestCase): + + def testIt(self): + # We need a qapp otherwise Qt will crash when trying to detect the + # current platform + app = QApplication([]) + ev1 = QKeyEvent(QEvent.KeyRelease, Qt.Key_Delete, Qt.NoModifier) + ev2 = QKeyEvent(QEvent.KeyRelease, Qt.Key_Copy, Qt.NoModifier) + ks = QKeySequence.Delete + self.assertEqual(ev1, ks) + self.assertEqual(ks, ev1) + self.assertNotEqual(ev2, ks) + self.assertNotEqual(ks, ev2) + +if __name__ == '__main__': + unittest.main() |