Uploaded image for project: 'Qt for MCUs'
  1. Qt for MCUs
  2. QTMCU-218

Qul::Signal doesn't work as stated in the document

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Not Evaluated
    • None
    • Qt for MCUs 2.5
    • Documentation, QUL Team
    • None
    • All

    Description

      The documentation link : https://doc.qt.io/QtForMCUs-2.5/qul-signal.html

      In the documentation above, there's a section says:

       

      So I tried it with Qt for MCUs 2.5 Desktop and it didn't work. The project is attached. (SignalTest.zip)

      I have MyObj.h which is inside of CustomModule, like so.

      #ifndef MYOBJ_H
      #define MYOBJ_H
      #include <qul/signal.h>
      #include <qul/object.h>
      class MyObj : public Qul::Object
      {
      public:    
          Qul::Signal<void()> onBar;
      };
      #endif // MYOBJ_H

      And I'm using this in SignalTest.qml, like so:

      import QtQuick
      import CustomModule
      Rectangle {    
          Text {        
              anchors.centerIn: parent        
              text: "Qt for MCUs"    
          }    
          MyObj {        
              id: myobj        
              onBar: console.log("bar")    
          }
          Component.onCompleted: {myobj.bar()}
      }

      As far as I can see, this is exactly doing what's stated in the documentation : If signal member is called exactly as the QML signal handler it will be treated as signal named without on prefix and starting with lower case letter.

      However, this results in a build error.

      C:/Users/81808/Downloads/SignalTest/SignalTest.qml:15: error: Type myobj_MyObj does not have a property bar for calling
              myobj.bar()

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            tonyl Tony Leinonen
            mikio_hirai Mikio Hirai
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes