Fix bug 879 - "QDoubleSpinBox: Can't call the parent validate() method from a subclass"
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
Luciano Wolf <luciano.wolf@openbossa.org>
This commit is contained in:
parent
590abafc54
commit
df30f37512
3 changed files with 70 additions and 33 deletions
|
|
@ -2706,20 +2706,8 @@
|
||||||
</modify-function>
|
</modify-function>
|
||||||
</object-type>
|
</object-type>
|
||||||
<object-type name="QVBoxLayout"/>
|
<object-type name="QVBoxLayout"/>
|
||||||
<object-type name="QValidator">
|
|
||||||
<enum-type name="State"/>
|
<template name="validator_conversionrule">
|
||||||
<modify-function signature="fixup(QString &)const">
|
|
||||||
<modify-argument index="return">
|
|
||||||
<replace-type modified-type="QString"/>
|
|
||||||
</modify-argument>
|
|
||||||
<inject-code class="target" position="end">
|
|
||||||
<insert-template name="return_QString"/>
|
|
||||||
</inject-code>
|
|
||||||
</modify-function>
|
|
||||||
<modify-function signature="validate(QString &, int &)const">
|
|
||||||
<modify-argument index="return">
|
|
||||||
<replace-type modified-type="PyObject"/>
|
|
||||||
<conversion-rule class="native">
|
|
||||||
QValidator::State %out;
|
QValidator::State %out;
|
||||||
|
|
||||||
if (PySequence_Check(%PYARG_0)) {
|
if (PySequence_Check(%PYARG_0)) {
|
||||||
|
|
@ -2753,6 +2741,23 @@
|
||||||
pyResult->ob_type->tp_name);
|
pyResult->ob_type->tp_name);
|
||||||
return QValidator::State();
|
return QValidator::State();
|
||||||
}
|
}
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<object-type name="QValidator">
|
||||||
|
<enum-type name="State"/>
|
||||||
|
<modify-function signature="fixup(QString &)const">
|
||||||
|
<modify-argument index="return">
|
||||||
|
<replace-type modified-type="QString"/>
|
||||||
|
</modify-argument>
|
||||||
|
<inject-code class="target" position="end">
|
||||||
|
<insert-template name="return_QString"/>
|
||||||
|
</inject-code>
|
||||||
|
</modify-function>
|
||||||
|
<modify-function signature="validate(QString &, int &)const">
|
||||||
|
<modify-argument index="return">
|
||||||
|
<replace-type modified-type="PyObject"/>
|
||||||
|
<conversion-rule class="native">
|
||||||
|
<insert-template name="validator_conversionrule"/>
|
||||||
</conversion-rule>
|
</conversion-rule>
|
||||||
</modify-argument>
|
</modify-argument>
|
||||||
<inject-code class="target" position="end">
|
<inject-code class="target" position="end">
|
||||||
|
|
@ -4127,6 +4132,9 @@
|
||||||
<modify-function signature="validate(QString &, int &)const">
|
<modify-function signature="validate(QString &, int &)const">
|
||||||
<modify-argument index="return">
|
<modify-argument index="return">
|
||||||
<replace-type modified-type="PyObject"/>
|
<replace-type modified-type="PyObject"/>
|
||||||
|
<conversion-rule class="native">
|
||||||
|
<insert-template name="validator_conversionrule"/>
|
||||||
|
</conversion-rule>
|
||||||
</modify-argument>
|
</modify-argument>
|
||||||
<inject-code class="target" position="end">
|
<inject-code class="target" position="end">
|
||||||
<insert-template name="return_tuple_QValidator_QString_int"/>
|
<insert-template name="return_tuple_QValidator_QString_int"/>
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,7 @@ PYSIDE_TEST(bug_854.py)
|
||||||
PYSIDE_TEST(bug_860.py)
|
PYSIDE_TEST(bug_860.py)
|
||||||
PYSIDE_TEST(bug_862.py)
|
PYSIDE_TEST(bug_862.py)
|
||||||
PYSIDE_TEST(bug_871.py)
|
PYSIDE_TEST(bug_871.py)
|
||||||
|
PYSIDE_TEST(bug_879.py)
|
||||||
PYSIDE_TEST(bug_882.py)
|
PYSIDE_TEST(bug_882.py)
|
||||||
PYSIDE_TEST(customproxywidget_test.py)
|
PYSIDE_TEST(customproxywidget_test.py)
|
||||||
PYSIDE_TEST(deepcopy_test.py)
|
PYSIDE_TEST(deepcopy_test.py)
|
||||||
|
|
|
||||||
28
tests/QtGui/bug_879.py
Normal file
28
tests/QtGui/bug_879.py
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
import unittest
|
||||||
|
from PySide.QtCore import *
|
||||||
|
from PySide.QtGui import *
|
||||||
|
|
||||||
|
class MySpinBox(QSpinBox):
|
||||||
|
|
||||||
|
def validate(self,text,pos):
|
||||||
|
return QSpinBox.validate(self,text,pos)
|
||||||
|
|
||||||
|
class TestBug879 (unittest.TestCase):
|
||||||
|
|
||||||
|
def testIt(self):
|
||||||
|
app = QApplication([])
|
||||||
|
self.box = MySpinBox()
|
||||||
|
self.box.show()
|
||||||
|
|
||||||
|
QTimer.singleShot(0, self.sendKbdEvent)
|
||||||
|
QTimer.singleShot(100, app.quit)
|
||||||
|
app.exec_()
|
||||||
|
|
||||||
|
self.assertEqual(self.box.text(), '0')
|
||||||
|
|
||||||
|
def sendKbdEvent(self):
|
||||||
|
ev = QKeyEvent(QEvent.KeyPress, Qt.Key_A, Qt.NoModifier, 'a')
|
||||||
|
QCoreApplication.sendEvent(self.box, ev)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
Loading…
Add table
Add a link
Reference in a new issue