Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. property name <<speed>> invalid. (M16)

property name <<speed>> invalid. (M16)

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
4 Posts 3 Posters 497 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sadok_J
    wrote on last edited by
    #1

    Hi! I'm trying to call 3 files in my dashboard.qml file : speed, RPM and EngCoolTemp. The RPM and EngCoolTemp called correctly with no error but when i call speed it gives me the "property name <<speed>> invalid. (M16)" error; here's the code:

    import QtQuick 6.2
    import QtQuick.Controls 6.2

    Item {
    id: id_dashboard

    // To create data for demonstration purposes
    property int countSpeed: 0
    property int countRPM: 0
    property int countEngCoolTemp: 0
    
    Timer {
        id: id_timer
        repeat: true
        interval: 1000
        running: true
    
        onTriggered: {
            updateSpeed();
            updateEngCoolTemp();
            updateRPM();
        }
    }
    
    // Speed Gauge
    Rectangle {
        id: id_speedArea
    
        anchors {
            horizontalCenter: parent.horizontalCenter
        }
        width: parent.width * 0.4
        height: width
        color: "black"
        radius: width / 2
        z: 1
    
        speed {
            id: id_speed
            anchors.fill: id_speedArea
            anchors.margins: id_speedArea.width * 0.025
        }
    }
    
    // RPM Gauge
    Rectangle {
        id: id_RPMArea
    
        anchors {
            bottom: id_speedArea.bottom
        }
        x: parent.width / 20
        width: parent.width * 0.35
        height: width
        color: "black"
        radius: width / 2
    
        RPM {
            id: id_RPM
            anchors.fill: id_RPMArea
            anchors.margins: id_RPMArea.width * 0.025
        }
    }
    
    // Engine Coolant Temperature Gauge
    Rectangle {
        id: id_EngCoolTempArea
    
        anchors {
            bottom: id_speedArea.bottom
        }
        x: parent.width - parent.width / 2.5
        width: parent.width * 0.35
        height: width
        color: "black"
        radius: width / 2
    
        EngCoolTemp {
            id: id_EngCoolTemp
            anchors.fill: id_EngCoolTempArea
            anchors.margins: id_EngCoolTempArea.width * 0.025
        }
    }
    
    // Divider
    Rectangle {
        id: id_divider
    
        anchors {
            bottom: id_speedArea.bottom
            left: id_RPMArea.horizontalCenter
            right: id_EngCoolTempArea.horizontalCenter
        }
        height: id_RPMArea.width / 2
        color: "black"
        z: -1
    }
    
    function updateSpeed() {
        countSpeed++;
        if (countSpeed % 2 === 0) {
            id_speed.value = 0;
        } else {
            id_speed.value = 280;
        }
    }
    
    function updateEngCoolTemp() {
        countEngCoolTemp++;
        if (countEngCoolTemp % 3 === 0) {
            if (id_EngCoolTemp.value === 0) {
                id_EngCoolTemp.value = 120;
            } else {
                id_EngCoolTemp.value = 50;
            }
        }
    }
    
    function updateRPM() {
        countRPM++;
        if (countRPM % 2 === 0) {
            if (id_RPM.value === 0) {
                id_RPM.value = 7000;
            } else {
                id_RPM.value = 0;
            }
        }
    }
    

    }
    how can i solve this problem.and thanks!

    1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2

      speed {} - Component should start with Uppercase letters. Just see this.

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      1 Reply Last reply
      0
      • S Offline
        S Offline
        Sadok_J
        wrote on last edited by
        #3

        if i write it with an uppercase S, it gives me this error : unknown component.(M300)

        1 Reply Last reply
        0
        • MarkkyboyM Offline
          MarkkyboyM Offline
          Markkyboy
          wrote on last edited by
          #4

          Presumably, your 'Speed.qml' is in another directory, I don't see any import statement heading your file.

          Don't just sit there standing around, pick up a shovel and sweep up!

          I live by the sea, not in it.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved