.data() in ModelView models

Heads up! You've already completed this tutorial.

Jerry_Zhou | 2020-05-07 18:42:52 UTC | #1

Hello! I am a confused as to the usage of the data() method that overrides the QAbstractListModel. It is never actually invoked despite being explained as the only way views can retrieve data from the model. I see that in the code, views retrieve data instead by just directly using todo[index] rather than calling the data() method. I was also wondering how roles are then assigned to these data values?


The complete guide to packaging Python GUI applications with PyInstaller.
[[ discount.discount_pc ]]% OFF for the next [[ discount.duration ]] [[discount.description ]] with the code [[ discount.coupon_code ]]

Purchasing Power Parity

Developers in [[ country ]] get [[ discount.discount_pc ]]% OFF on all books & courses with code [[ discount.coupon_code ]]
Well done, you've finished this tutorial! Mark As Complete
[[ user.completed.length ]] completed [[ user.streak+1 ]] day streak

.data() in ModelView models was written by Martin Fitzpatrick .

Martin Fitzpatrick has been developing Python/Qt apps for 8 years. Building desktop applications to make data-analysis tools more user-friendly, Python was the obvious choice. Starting with Tk, later moving to wxWidgets and finally adopting PyQt.