Hi Tobias,

2011/2/7 Tobias Quinn <[email protected]>:
> I have a class that is a inherits from a QAbstractListModel and I want
> to emit a dataChanged signal (to signal a QML ListView). I've tried the
> following:
>
> self.dataChanged.emit(1, 1)
>
> but I get the error
>
> TypeError: Unknown type used to emit a signal: QModelIndex
>
> Am I going about this the wrong way?

You probably want to use:

self.dataChanged.emit(QModelIndex(1, 1), QModelIndex(1, 1))

That said, if you are not using Qt 4.7.1, you might be affected by
that bug even if you don't get the TypeError later:

http://bugreports.qt.nokia.com/browse/QTBUG-13664

If your QAbstractListModel data consists of QObjects that have
properties that get displayed in the QML ListView, you can also effect
a display update if you emit the notify signal for the properties that
you are displaying (on the objects directly without going through
QAbstractListModel's API). Depending on how many properties you have
and how difficult your delegates are, notifying changes for only some
properties might be more efficient than emitting a dataChanged signal.

HTH.
Thomas
_______________________________________________
PySide mailing list
[email protected]
http://lists.openbossa.org/listinfo/pyside

Reply via email to