<div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div>Hi£¬I write a python model which is subclass of QabstractListModel and use it in qml. A slot to qml is£º</div><div><br></div><div>    @pyqtSlot(int,int,QModelIndex,result=bool)</div><div>    def removeRows(self,row,count,parent = QModelIndex()):</div><div>        ## 1,validate args codes,and call self.beginRemoveRows</div><div>        ##  2,remove releated rows by call 3rd library</div><div>       ## ##### throw Exception but not work #####</div><div>        ## 3,update self.__items and call self.endRemoveRows()</div><div>        return True</div><div><br></div><div>The slot is defined to return boolean value to the caller.So I can not export any error or exception message to qml layer to make user watch some warnings.</div><div>It seems the only way is to throw exception in the slot to make qml caller process specific errors ,But when I throw exception in slot,qml can not receive or catch it.</div><div> I read the page from qt forum: <a href="https://forum.qt.io/topic/37157/throwing-qml-exception-from-c-in-qtquick-2-application,but" _src="https://forum.qt.io/topic/37157/throwing-qml-exception-from-c-in-qtquick-2-application,but" style="color: rgb(6, 73, 119);">https://forum.qt.io/topic/37157/throwing-qml-exception-from-c-in-qtquick-2-application</a>  but do not get a solution.</div><div>Can anyone give me some advice? </div><div>Thank you!</div></div><br><br><span title="neteasefooter"><p> </p></span>