[PyQt] Do not avto convert python date to QVariant

Alexandr N Zamaraev tonal at promsoft.ru
Tue May 26 10:49:10 BST 2009


[code]
from PyQt4 import QtCore
import datetime

def show(d, QtType):
   print 'pytype:', d
   v = QtCore.QVariant(d)
   print 'from variant:', str(QtCore.QVariant(d).toString())
   print 'from qttype:', str(QtCore.QVariant(QtType(d)).toString())

show(datetime.date.today(), QtCore.QDate)
print
show(datetime.datetime.today(), QtCore.QDateTime)
print
show(datetime.datetime.today().time(), QtCore.QTime)
[/code]
In PyQt 4.4.4 all converts.


More information about the PyQt mailing list