[PyQt] QAbstractItemModel::data and invalid QVariant

Jens Hansen jens.v.han at gmail.com
Tue Feb 21 06:35:45 GMT 2017


Hey,

I wouldn't know how this is dealt with underneath but you are describing
the changes between pyqt api versions. While previously you had to return
valid QVariant objects and now the api is designed to deal with native
Python types.

Regards
Jens

On 21 Feb 2017 05:32, "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?
>
> Florian
>
> [1] http://doc.qt.io/qt-5/qabstractitemmodel.html#data
>
> --
> http://www.the-compiler.org | me at the-compiler.org (Mail/XMPP)
>    GPG: 916E B0C8 FD55 A072 | http://the-compiler.org/pubkey.asc
>          I love long mails! | http://email.is-not-s.ms/
>
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> https://www.riverbankcomputing.com/mailman/listinfo/pyqt
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20170221/9b7bf745/attachment-0001.html>


More information about the PyQt mailing list