how to disconnect the method for a signal in qml?

前端 未结 2 912
独厮守ぢ
独厮守ぢ 2021-01-06 16:30

In QML, in some situations, I need to remove the old method to a signal and redefine a new method to handle the signal, a demo is as following:

import QtQuic         


        
2条回答
  •  走了就别回头了
    2021-01-06 16:42

    You haven't used the explicit connect() function to begin with. To disconnect() a function, it has to have been connected explicitly using connect().

    There is an example here that might help:

    http://doc.qt.io/qt-5/qtqml-syntax-signals.html#connecting-signals-to-methods-and-signals

提交回复
热议问题