[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: [PyQt] [PyQt5 BUG] the 3rd parameter of QAbstractItemModel::dataChanged() is optional
From: Phil Thompson <phil () riverbankcomputing ! com>
Date: 2013-12-21 15:47:18
Message-ID: 9fb9bffd2698b8e3aa9395e57865fe49 () www ! riverbankcomputing ! com
[Download RAW message or body]
On 20-12-2013 4:46 am, iMath wrote:
> when I run the code here
> http://codepad.org/ubtleeFG
> the following error happened
>
>>>>
> Traceback (most recent call last):
> File "E:g.py", line 22, in timerHit
> self.dataChanged.emit (topLeft, topLeft);
> TypeError: QAbstractItemModel.dataChanged[QModelIndex, QModelIndex,
> list-of-int] signal has 3 argument(s) but 2 provided
>
> the cause is that the 3rd parameter of
>
> VOID QABSTRACTITEMMODEL::DATACHANGED(CONST QMODELINDEX &_ TOPLEFT_,
> CONST QMODELINDEX &_ BOTTOMRIGHT_, CONST QVECTOR<INT> &_ ROLES_ =
> QVECTOR<INT> ()) [SIGNAL]
>
> is optional,while in PyQt5 it seems not .
Qt implements signals with default arguments as multiple signals with
fixed arguments. The overload with the largest number of arguments is
the default one as far as PyQt is concerned - the one with 3 arguments
in this case.
Therefore you must specify the 3rd argument...
self.dataChanged.emit(topLeft, topLeft, [])
...or specify the overload with 2 arguments...
self.dataChanged[QModelIndex, QModelIndex].emit(topLeft, topLeft)
Tonight's snapshot makes emit() a bit smarter so that your current...
self.dataChanged(topLeft, topLeft)
...will work.
Phil
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic