[PyQt] QDateEdit is ignoring the sip API level 2

Daniele Esposti expo at expobrain.net
Tue Jun 7 10:55:46 BST 2011

This simple example raise an AssertionError because the type of the
value returned by the QDateEdit.date() property is a QDate instance
even the sip API level for QDate is set to 2.

Here the example which triggers the problem:

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import datetime
import sip

sip.setapi( "QDate", 2 )

from PyQt4 import QtGui

app = QtGui.QApplication( [] )

assert( isinstance( QtGui.QDateEdit().date(), datetime.date ) )

Daniele Esposti

My Blog http://www.expobrain.net
LinkedIn http://www.linkedin.com/in/danieleesposti
Twitter http://www.twitter.com/#!/expobrain

More information about the PyQt mailing list