On Tue, Aug 10, 2010 at 12:01 PM, Luca Donaggio <[email protected]> wrote:

> First of all, thanks to all the PySide devs for your efforts in delivering
> this great set of python - qt bindings!
>
> While adapting my application to the new 0.4.1 (Maemo Fremantle) release, I
> hit a possible bug (I mean, everything used to work just fine with PySide
> 0.3.x); I attached a sample code to this message which triggers this error:
>
> Error calling slot "openSubWin"
> Traceback (most recent call last):
>   File "pyside-example.py", line 21, in openSubWin
>     self.subWindow.show()
> NotImplementedError: pure virtual method 'QAbstractListModel.rowCount()'
> not implemented.
> Traceback (most recent call last):
>   File "pyside-example.py", line 65, in <module>
>     sys.exit(app.exec_())
> NotImplementedError: pure virtual method 'QAbstractListModel.rowCount()'
> not implemented.
>
> The offending line is number 53 in function "data":
>
>     def data(self,index = QModelIndex(),role = Qt.DisplayRole):
> ----> if index.isValid() & (index.row() >= 0) & (index.row() <
> index.model().rowCount()): <----
>             if role == Qt.DisplayRole:
>                 return self.__items[index.row()]
>             else:
>                 return None
>         else:
>             return None
>
> accessing the data model using index.model() seems to cause the vanishing
> of the (re)definition of the "rowCount" method; if we change the line in:
>
>    if index.isValid() & (index.row() >= 0) & (index.row() <
> self.rowCount()):
>
> it works as expected, but sometimes this is not possible (inside a custom
> item delegate class, for example, its methods receive a QModelIndex instance
> as a parameter, and I need its model() property to properly work).
>
> --
> Luca Donaggio
>

Just to add some detail: there are situations when calling the rowCount()
method through QModelIndex.model() works just fine, the error (if it turns
to be an error) seems to be limited to instances of subclasses of
QAbstractListModel and QStyledItemDelegate.

-- 
Luca Donaggio
_______________________________________________
PySide mailing list
[email protected]
http://lists.openbossa.org/listinfo/pyside

Reply via email to