4 # Copyright 2009 Develer S.r.l. (http://www.develer.com/)
9 # Author: Lorenzo Berni <duplo@develer.com>
12 from PyQt4.QtCore import *
14 def getString(qvariant):
15 string = unicode(qvariant.toString())
18 def convertString(string):
19 return QVariant(string)
21 def getStringList(qvariant):
22 string_list = [unicode(string) for string in qvariant.toStringList()]
25 def convertStringList(string_list):
26 return QVariant(QStringList(string_list))
28 def getStringDict(qvariant):
30 for key, value in qvariant.toMap().items():
31 dict_str_str[unicode(key)] = unicode(value.toString())
34 def convertStringDict(string_dict):
36 for key, value in string_dict.items():
37 result_dict[QString(key)] = QString(value)
38 return QVariant(result_dict)
40 def getBool(qvariant):
41 return qvariant.toBool()
43 def convertBool(boolean):
44 return QVariant(boolean)
46 def getBoolDict(qvariant):
48 for key, value in qvariant.toMap().items():
49 dict_str_bool[unicode(key)] = value.toBool()
52 def convertBoolDict(dict_str_bool):
54 for key, value in dict_str_bool.items():
55 result_dict[QString(key)] = value
56 return QVariant(result_dict)
58 def getDict(qvariant):
60 for key, value in qvariant.toMap().items():
61 dict_str_variant[unicode(key)] = value
62 return dict_str_variant
64 def convertDict(dict_str_variant):
66 for key, value in dict_str_variant.items():
67 result_dict[QString(key)] = value
68 return QVariant(result_dict)