PySide Bugzilla Closed for New Bugs

PySide is now a Qt Add-on and uses the Qt Project's JIRA Bug Tracker instead of this Bugzilla instance. This Bugzilla is left for reference purposes.

Bug 633 - bool of null QDate (possibly other empty QString/null QObj types?) returns True for empty instance; probably should be False
: bool of null QDate (possibly other empty QString/null QObj types?) returns Tr...
Status: CLOSED FIXED
Product: PySide
Classification: Unclassified
Component: QtCore
: 1.0.0 beta3
: All All
: P3 normal
Assigned To: Hugo Parente Lima
:
:
:
  Show dependency treegraph
 
Reported: 2011-01-21 23:47 EET by forensic7278
Modified: 2011-02-02 15:46 EET (History)
9 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description forensic7278 2011-01-21 23:47:36 EET
example:

from PyQt4.QtCore import *
today = QDate.currentDate()
nodate = QDate()
print bool(today), bool(nodate)
print today, nodate
>>
True False
PyQt4.QtCore.QDate(2011, 1, 21) PyQt4.QtCore.QDate()


from PySide.QtCore import *
today = QDate.currentDate()
nodate = QDate()
print bool(today), bool(nodate)
print today, nodate

>>
True True
<PySide.QtCore.QDate("Fri Jan 21 2011")  at 0xb741b680>
<PySide.QtCore.QDate("")  at 0xb741b698>
Comment 1 Hugo Parente Lima 2011-01-24 10:43:45 EET
I'll add the following behaviour to the binding generation... if a class have a
method "bool isNull() const" it will be used in the "bool cast", it's somehow a
heuristic but I think it'll work fine.
Comment 2 Hugo Parente Lima 2011-01-24 17:27:52 EET
Fixed in commits:

shiboken/55daad72b2358614bd4ec69728887ba631f01a4c
pyside/286f9c6d099dceb88dc1dfac8bdb0917b9fef2c1

I used the "bool isNull() const" approach.
Comment 3 renato filho 2011-02-02 15:46:11 EET
released on beta 5