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

The code snippet in the PathMove documentation doesn't work as it is.

    XMLWordPrintable

Details

    • All

    Description

      doc link : https://doc.qt.io/QtForMCUs-2.4/qml-qtquick-pathmove.html

      The document above has a code snippet below:

      Path {
          startX: 0; startY: 100
          PathLine { x: 100; y: 100 }
          PathMove { x: 200; y: 100 }
          PathLine { x: 300; y: 100 }
      } 

      But since this code uses Path, which is invisible, if the reader copies and pastes this code to their Qt Creator and runs the app, it won't draw a line in the Window.

      I suggest replacing the current code snippet with this one, with a note saying the reader should link the Qul::Shapes module to their project to import QtQuick.Shapes.

      import QtQuick 2.0
      import QtQuick.Shapes
      Rectangle {
          width: 300
          height: 300
          Shape {
              ShapePath {
                  strokeColor: "black"
                  startX: 0; startY: 100
                  PathLine { x: 100; y: 100 }
                  PathMove { x: 200; y: 100 }
                  PathLine { x: 300; y: 100 }
              }
          }
      }
      

      This code outputs this result:

      Attachments

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

        Activity

          People

            estorman Esa Törmänen
            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