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. Cannot assign to non-existent property in another qml file
Forum Update on Monday, May 27th 2025

Cannot assign to non-existent property in another qml file

Scheduled Pinned Locked Moved QML and Qt Quick
5 Posts 3 Posters 10.9k 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.
  • H Offline
    H Offline
    houmingc
    wrote on 20 Dec 2014, 01:51 last edited by
    #1

    error is Cannot assign to non-existent property "marqueeText"
    i believe a qml file can call another qml by its filename but i got an error. Please enlighten

    @
    ===============marqueeText.qml==================================
    import QtQuick 2.0

    Rectangle {

        id:marqueeText
        height: scrollingText.height
        clip: true
        property int tempX: marqueeText.width
        property alias text: scrollingText.text
        Text {
            x: tempX
            id:scrollingText
            color: "Yellow" /* Hard code text color for now */
            font.pixelSize: marqueeText.height - 6;
        }
        Timer {
            id:timer
            interval: 200; running: true; repeat: true
            onTriggered:{
                tempX = tempX - 5
                scrollingText.x = tempX;
                console.debug("Tempx"+ tempX + "TextWidth = " + scrollingText.width, " Height = " + marqueeText.height)
    
                if( tempX < -scrollingText.width) {
                    tempX = marqueeText.width;
                    console.debug("Restartlling Text")
                }
               }
        }
    

    }
    @
    =========main.qml============================
    @
    import QtQuick 2.2
    import QtQuick.Window 2.1
    import QtQuick.Layouts 1.1
    import QtMultimedia 5.0

    Rectangle {
    width: 100
    height: 620
    id: screen

    Grid {
        columns: 2
        spacing: 0
    
        Rectangle {
            id: video;
            color: "black";
            width: 600;
            height: 432
            Video {
                id: videofile
                //playing: true
                source: "video/Bear.wmv"
                width: 600
                height: 432
                opacity: 0.9
                focus: true
                onStopped: {
                    videofile.play()
                }
            }
        }
        Rectangle {
            id: picture; width: 200; height: 432
            anchors.left: video.right
            Image {
                source: "pic/phone.jpg"
            }
        }
        Rectangle {
            id: text
            width: 800; height: 48
            color: "blue"
            marqueeText {                       //error
                id:scrolltext
                width: 800
                height: 48
                text: "Qt Quick Digital Signage Demo"
            }
        }
    

    }
    }

    @

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dvb0222
      wrote on 20 Dec 2014, 02:08 last edited by
      #2

      Start the class name with an uppercase letter.

      I know, pretty non-intuitive.


      David Van Beveren
      Oak Park Technology Corp.
      Malibu, California
      vbdavid@gmail.com

      1 Reply Last reply
      1
      • H Offline
        H Offline
        houmingc
        wrote on 21 Dec 2014, 06:53 last edited by
        #3

        you mean id to cap(MarqueeText) or filename & caller in main to cap

        1 Reply Last reply
        0
        • D Offline
          D Offline
          dvb0222
          wrote on 21 Dec 2014, 18:58 last edited by
          #4

          All three need to start with a cap.


          David Van Beveren
          Oak Park Technology Corp.
          Malibu, California
          vbdavid@gmail.com

          1 Reply Last reply
          0
          • D Offline
            D Offline
            David Stiel
            wrote on 28 Dec 2014, 23:21 last edited by
            #5

            You have probably already noticed that the id in marqueeText.qml should not start with an upper case letter as described "here":http://doc.qt.io/qt-5/qtqml-syntax-objectattributes.html#the-id-attribute

            I main.qml you do
            @
            MarqueeText {
            id:scrolltext
            width: 800
            height: 48
            text: "Qt Quick Digital Signage Demo"
            }
            @

            This allocates a new instance of the MarqueeText class/element and has nothing to do with the id you provided in the MarqueeText.qml file

            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