On Tue, 26 May 2009 16:49:10 +0700, Alexandr N Zamaraev <[email protected]> wrote: > [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.
This is a deliberate change. It is documented - but I'll expand the documentation to mention the datetime types explicitly. Use toPyObject() to get the Python datetime instances back. If you want the old behaviour then convert the Python types to their Qt equivalents before converting to QVariant - and that will work Ok with earlier versions as well. Phil _______________________________________________ PyQt mailing list [email protected] http://www.riverbankcomputing.com/mailman/listinfo/pyqt
