<DIV>when you run the code here<BR><A href="http://codepad.org/ubtleeFG" target=_blank><FONT color=#1e5494>http://codep<WBR>ad.org/ubtle<WBR>eFG</FONT></A><BR>the error I mentioned last time disappeared ,but this program still doesn't work.</DIV>
<DIV> </DIV>
<DIV>tested on PyQt5-5.2-gpl-Py3.3-Qt5.2.0-x32  ,WinXp</DIV>
<DIV>
<DIV><BR></DIV>
<DIV style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 12px; PADDING-BOTTOM: 2px; PADDING-TOP: 2px; FONT-FAMILY: Arial Narrow">------------------ 原始邮件 ------------------</DIV>
<DIV style="PADDING-RIGHT: 8px; PADDING-LEFT: 8px; FONT-SIZE: 12px; BACKGROUND: #efefef; PADDING-BOTTOM: 8px; PADDING-TOP: 8px">
<DIV><B>发件人:</B> "phil";<phil@riverbankcomputing.com>;</DIV>
<DIV><B>发送时间:</B> 2013年12月24日(星期二) 上午6:28</DIV>
<DIV><B>收件人:</B> "iMath"<2281570025@qq.com>; <WBR></DIV>
<DIV></DIV>
<DIV><B>主题:</B> Re: 回复: [PyQt5 BUG] the 3rd parameter ofQAbstractItemModel::dataChanged() is optional</DIV></DIV>
<DIV><BR></DIV>On 23-12-2013 1:05 pm, iMath wrote:<BR>> “Qt implements signals with default arguments as multiple signals<BR>> with<BR>>  fixed arguments. The overload with the largest number of arguments <BR>> is<BR>><BR>>  the default one.”<BR>><BR>> you know this from where ?<BR><BR>For the first sentence, by looking at the Qt source code.<BR><BR>For the second sentence, because that's the way I wrote it.<BR><BR>> BTW ,self.dataChanged(topLeft, topLeft) works well(without modified)<BR>> in PyQt4 J<BR><BR>...because the signature in Qt4 is different to the signature in Qt5.<BR><BR>Phil<BR><BR>> ------------------ 原始邮件 ------------------<BR>><BR>> 发件人: "phil";<phil@riverbankcomputing.com>;<BR>> 发送时间: 2013年12月21日(星期六) 晚上11:47<BR>> 收件人: "iMath"<2281570025@qq.com>;<BR>> 抄送: "pyqt"<pyqt@riverbankcomputing.com>;<BR>> 主题: Re: [PyQt5 BUG] the 3rd parameter<BR>> ofQAbstractItemModel::dataChanged() is optional<BR>><BR>> On 20-12-2013 4:46 am, iMath wrote:<BR>>> when I run the code here<BR>>> http://codepad.org/ubtleeFG<BR>>> the following error happened<BR>>><BR>>>>>><BR>>> Traceback (most recent call last):<BR>>> File "E:g.py", line 22, in timerHit<BR>>> self.dataChanged.emit (topLeft, topLeft);<BR>>> TypeError: QAbstractItemModel.dataChanged[QModelIndex, QModelIndex,<BR>>> list-of-int] signal has 3 argument(s) but 2 provided<BR>>><BR>>> the cause is that the 3rd parameter of<BR>>><BR>>> VOID QABSTRACTITEMMODEL::DATACHANGED(CONST QMODELINDEX &_ TOPLEFT_,<BR>>> CONST QMODELINDEX &_ BOTTOMRIGHT_, CONST QVECTOR<INT> &_ ROLES_ =<BR>>> QVECTOR<INT> ()) [SIGNAL]<BR>>><BR>>> is optional,while in PyQt5 it seems not .<BR>><BR>> Qt implements signals with default arguments as multiple signals with<BR>> fixed arguments. The overload with the largest number of arguments is<BR>> the default one as far as PyQt is concerned - the one with 3 <BR>> arguments<BR>><BR>> in this case.<BR>><BR>> Therefore you must specify the 3rd argument...<BR>><BR>>  self.dataChanged.emit(topLeft, topLeft, [])<BR>><BR>> ...or specify the overload with 2 arguments...<BR>><BR>>  self.dataChanged[QModelIndex, QModelIndex].emit(topLeft, topLeft)<BR>><BR>> Tonight's snapshot makes emit() a bit smarter so that your current...<BR>><BR>>  self.dataChanged(topLeft, topLeft)<BR>><BR>> ...will work.<BR>><BR>> Phil<BR>> .<BR><BR>.<BR>
<DIV></DIV></DIV>