Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-41699

Exposing Methods (including Qt Slots) Example Code Error

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.4.0 RC
    • 5.3.2
    • Documentation
    • None
    • 0c8bb607e1371b301650029a3e5dfe4641cc2f98

    Description

      The main documentation page topic is

      Exposing Attributes of C++ Types to QML

      The subtopic is

      Exposing Methods (including Qt Slots).

      The c++ code example has this snippet

           Message msg;
           engine.rootContext()->setContextProperty("msg", &msg);
      

      Then the corresponding QML has this usage

      msgBoard.postMessage("Hello from QML")
                  console.log("Result of 
      

      I strongly suspect the C++ code should be:

           MessageBoard msgBoard;
           engine.rootContext()->setContextProperty("msgBoard", &msgBoard);
      

      <Editorial>Sure wish there was a more "wiki" way to propose an edit to a Qt documentation page.</Editorial>

      Attachments

        For Gerrit Dashboard: QTBUG-41699
        # Subject Branch Project Status CR V

        Activity

          People

            veshivas Venugopal Shivashankar
            rolias Tod Gentille
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes