PySide2: dataChanged signal in QAbstractItemModel has changed?

qt
python
maya

#1

I’m trying to emit the dataChanged signal, and it seems in PySide2 the method signature has changed.

void QAbstractItemModel::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector &roles = QVector ())

What’s the equivalent of a QVector in python? I tried the existing QVector2D/3D classes, a list, tuple, etc… crashes Maya.

I like the fact that you can signal what role has actually been emitted, but it doesn’t seem to be working.

Has anyone figured this one out?


#2

you could try something like this to possibly identify the type:

def test(*args, **kwargs):
    for arg in args:
        print(arg, type(arg))
    for key, val in kwargs.items():
        print(key, type(value))

abstract_item_model.dataChanged.connect(test)

And then do something to trigger the signal, and watch the output to check the values and types.


#3

Thanks. I just took the time to isolate it (should have done that before posting), and it turns out it was totally my fault. The list of roles works… it was a porting issue that for some reason raised this specific exception.

The exception was during the dataChanged signal, but was related to an assigned delegate that was broken (still calling QtGui rather than PySide2’s QtWidgets).


#4

Awesome glad you got it figured out.
And yeah, that whole namespace shift from QtGui, to QtWidgets is super annoying.