[PyQt] QAbstractItemModel::data and invalid QVariant

Phil Thompson phil at riverbankcomputing.com
Tue Feb 21 09:31:34 GMT 2017


On 21 Feb 2017, at 5:31 am, Florian Bruhin <me at the-compiler.org> wrote:
> 
> Hi,
> 
> the Qt docs for QAbstractItemModel::data say[1]:
> 
>    Note: If you do not have a value to return, return an invalid
>    QVariant instead of returning 0.
> 
> Yet returning None from Python seems to work fine. What happens behind
> the scenes there? Does PyQt convert the None I return to a null
> pointer, or to an invalid QVariant?

The latter.

Phil


More information about the PyQt mailing list