QML: Using cpp signal in QML always results in “Cannot assign to non-existent property”

前端 未结 1 1659
深忆病人
深忆病人 2020-12-19 09:23

I just want to connect a cpp signal to a qml slot and tried different ways, but it always results in the same QML-Error at runtime: Cannot assign to non-existent propert

相关标签:
1条回答
  • 2020-12-19 09:41

    For exposing signals from C++ Object you must follow some naming conventions:

    • Signal must begin by a lowercase letter in your C++ code, i.e void yourLongSignal()
    • Signal handler in QML will be named on<YourLongSignal>

    So, the only thing you have to edit in your code is to change

    signals:
        void processed(const QString& str);
    
    0 讨论(0)
提交回复
热议问题