diff options
author | Hugo Lima <hugo.lima@openbossa.org> | 2010-03-15 14:46:30 -0300 |
---|---|---|
committer | Hugo Lima <hugo.lima@openbossa.org> | 2010-03-17 18:17:13 -0300 |
commit | 781bdbe6321298e7bb567a717a8b0fca4cd0e7e2 (patch) | |
tree | 6eb7b4ab029f566d6aba94113cc16a579a9cdfef /PySide/QtCore/qchar_conversions.h | |
parent | b53b9e49ba3b277913b970df758b75b36cc253a4 (diff) |
Fixed PySide custom conversions to work with newer versions of shiboken generator.
Diffstat (limited to 'PySide/QtCore/qchar_conversions.h')
-rw-r--r-- | PySide/QtCore/qchar_conversions.h | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/PySide/QtCore/qchar_conversions.h b/PySide/QtCore/qchar_conversions.h index 345befade..6347c9311 100644 --- a/PySide/QtCore/qchar_conversions.h +++ b/PySide/QtCore/qchar_conversions.h @@ -1,25 +1,30 @@ namespace Shiboken { - -inline bool Shiboken::Converter<QChar >::isConvertible(PyObject* pyobj) +inline bool Shiboken::Converter<QChar >::isConvertible(PyObject* pyObj) { - return SbkPySide_QtCore_QChar_SpecialCharacter_Check(pyobj) - || SbkQLatin1Char_Check(pyobj) - || (PyString_Check(pyobj) && (PyString_Size(pyobj) == 1)) - || PyInt_Check(pyobj); + return PyObject_TypeCheck(pyObj, SbkType<QChar>()) + || SbkPySide_QtCore_QChar_SpecialCharacter_Check(pyObj) + || SbkQLatin1Char_Check(pyObj) + || (PyString_Check(pyObj) && (PyString_Size(pyObj) == 1)) + || PyInt_Check(pyObj); } -inline QChar Shiboken::Converter<QChar >::toCpp(PyObject* pyobj) +inline QChar Shiboken::Converter<QChar >::toCpp(PyObject* pyObj) { - if (!Shiboken_TypeCheck(pyobj, QChar)) { - if (SbkPySide_QtCore_QChar_SpecialCharacter_Check(pyobj)) - return QChar(Shiboken::Converter<QChar::SpecialCharacter >::toCpp(pyobj)); - else if (SbkQLatin1Char_Check(pyobj)) - return QChar(Shiboken::Converter<QLatin1Char >::toCpp(pyobj)); - else if (PyString_Check(pyobj) && PyString_Size(pyobj) == 1) - return QChar(Shiboken::Converter<char >::toCpp(pyobj)); - else if (PyInt_Check(pyobj)) - return QChar(Shiboken::Converter<int >::toCpp(pyobj)); + if (!Shiboken_TypeCheck(pyObj, QChar)) { + if (SbkPySide_QtCore_QChar_SpecialCharacter_Check(pyObj)) + return QChar(Shiboken::Converter<QChar::SpecialCharacter >::toCpp(pyObj)); + else if (SbkQLatin1Char_Check(pyObj)) + return QChar(Shiboken::Converter<QLatin1Char >::toCpp(pyObj)); + else if (PyString_Check(pyObj) && PyString_Size(pyObj) == 1) + return QChar(Shiboken::Converter<char >::toCpp(pyObj)); + else if (PyInt_Check(pyObj)) + return QChar(Shiboken::Converter<int >::toCpp(pyObj)); } - return *Converter<QChar*>::toCpp(pyobj); + return *Converter<QChar*>::toCpp(pyObj); +} + +inline PyObject* Converter<QChar>::toPython(const QChar& cppObj) +{ + return ValueTypeConverter<QChar>::toPython(cppObj); } } |