<div dir="ltr">I cannot suggest actual resources, as I learned the Qt Model/View the hard way: trying and experimenting (sometimes "randomly"), studying the documentation and the sources.<div><br></div><div>But, in the meantime, if you give us more precise questions, we might be able to help.</div><div><br>For instance, if you're referring to the argument of rowCount and index, the QModelIndex indicates an "empty" (and invalid) index that's commonly considered or referred to as the "root" index of the model.</div><div><br>A model can have more than two dimensions (tree models), and each index could be a child or parent of another, so the actual coordinates of an index are always three: row, column, parent ("depth").</div><div>When using table models, there obviously is no parent (since it's a bidimensional model), and that can be traced by having an invalid index (a new QModelIndex instance).</div><div>This is fundamental as the model has to know to what refer to when you only have one or two dimensions:</div><div><br></div><div>rowCount(row, parent): returns the row count of the *parent*, if the parent is invalid, it's assumed that it refers to the row count of the "top level".</div><div>index(row, column, parent): returns a QModelIndex at the given row/column *referred* to the parent; again, if the parent is invalid, it's the "top level" index at that row and column.</div><div><br></div><div>Note that it's common to default the parent argument to None for simple models, but it's usually better (especially for tree models) to use a QModelIndex() instead.</div><div><br></div><div>Hope this helps,</div><div><br></div><div>Maurizio</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Il giorno mar 22 giu 2021 alle ore 10:32 Stefan de Konink <<a href="mailto:stefan@konink.de">stefan@konink.de</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello,<br>
<br>
I have implemented a custom widget presenting a swimming lane graph that <br>
can interact with a model. It works pretty well, but there are some basic <br>
things I don't understand, for example the reason for adding <br>
QtCore.QModelIndex() to things like rowCount, and index.<br>
<br>
Is there any good tutorial or are there any reference widgets written in <br>
Python that are considered best in class and good learning material?<br>
<br>
-- <br>
Stefan<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature">È difficile avere una convinzione precisa quando si parla delle ragioni del cuore. - "Sostiene Pereira", Antonio Tabucchi<br><a href="http://www.jidesk.net" target="_blank">http://www.jidesk.net</a></div>