summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--PySide/QtCore/qvariant_conversions.h3
-rw-r--r--tests/QtCore/qbytearray_test.py8
2 files changed, 8 insertions, 3 deletions
diff --git a/PySide/QtCore/qvariant_conversions.h b/PySide/QtCore/qvariant_conversions.h
index 7a799e1c..a471ce64 100644
--- a/PySide/QtCore/qvariant_conversions.h
+++ b/PySide/QtCore/qvariant_conversions.h
@@ -28,6 +28,9 @@ struct Converter<QVariant>
} else if (Converter<QString>::checkType(pyObj)) {
// QVariant(const char*)
return QVariant(Converter<QString>::toCpp(pyObj));
+ } else if (Converter<QByteArray>::checkType(pyObj)) {
+ // QVariant(QByteArray)
+ return QVariant(Converter<QByteArray>::toCpp(pyObj));
} else if (PyFloat_CheckExact(pyObj)) {
// QVariant(double)
return QVariant(Converter<double>::toCpp(pyObj));
diff --git a/tests/QtCore/qbytearray_test.py b/tests/QtCore/qbytearray_test.py
index 20bba140..1c425b8e 100644
--- a/tests/QtCore/qbytearray_test.py
+++ b/tests/QtCore/qbytearray_test.py
@@ -5,7 +5,7 @@ import unittest
import ctypes
import sys
-from PySide.QtCore import QByteArray
+from PySide.QtCore import *
class QByteArrayTestToNumber(unittest.TestCase):
def testToNumberInt(self):
@@ -91,8 +91,10 @@ class QByteArrayOperatorAtSetterLargeIndex(unittest.TestCase):
obj[10] = 'normal'
self.assertEqual(obj, QByteArray('mystring normal'))
-
-
+class QByteArrayOnQVariant(unittest.TestCase):
+ def testQByteArrayOnQVariant(self):
+ a = QSettings().value("some_prop", QByteArray())
+ self.assertEqual(type(a), QByteArray)
if __name__ == '__main__':
unittest.main()