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 default property error
QtWS25 Last Chance

Cannot assign to non-existent default property error

Scheduled Pinned Locked Moved Solved QML and Qt Quick
5 Posts 2 Posters 8.8k 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.
  • T Offline
    T Offline
    torrancee
    wrote on last edited by
    #1

    Hi,

    Im struggling with error "Cannot assign to non-existent default property". Please check code below (2 files).
    It's not possible to create an instance of BlinkingTimer inside CowbellTimer. Any ideas will be helpful - i guess that solution is really simply but, hmmm .... i cannot find it.

    BlinkingTimer.qml

    import QtQuick 2.0
    
    Timer {
    
        interval: 50
        triggeredOnStart: false
        running: false
    
        onTriggered:{
                statusIndicator.active = false
        }
    }
    

    CowbellTimer.qml

    import QtQuick 2.0
    import QtMultimedia 5.8
    
    Timer {
        id: cowbellTimer
        interval: 1000
        triggeredOnStart: true
        running: false
        repeat: true
    
        BlinkingTimer {
            id: cowbellBlinking
        }
    }
    
    

    Cheers and thanks!

    E 1 Reply Last reply
    0
    • T torrancee

      Hi,

      Im struggling with error "Cannot assign to non-existent default property". Please check code below (2 files).
      It's not possible to create an instance of BlinkingTimer inside CowbellTimer. Any ideas will be helpful - i guess that solution is really simply but, hmmm .... i cannot find it.

      BlinkingTimer.qml

      import QtQuick 2.0
      
      Timer {
      
          interval: 50
          triggeredOnStart: false
          running: false
      
          onTriggered:{
                  statusIndicator.active = false
          }
      }
      

      CowbellTimer.qml

      import QtQuick 2.0
      import QtMultimedia 5.8
      
      Timer {
          id: cowbellTimer
          interval: 1000
          triggeredOnStart: true
          running: false
          repeat: true
      
          BlinkingTimer {
              id: cowbellBlinking
          }
      }
      
      

      Cheers and thanks!

      E Offline
      E Offline
      Eeli K
      wrote on last edited by
      #2

      @torrancee It looks like Timer doesn't have the default property (the property which you can create unnamed, using only the type, as you do now), as the error message indicates. You can try something like this (simplified, doesn't use your component names):

      Timer {
            property Timer t2: Timer {
            }
        }
      
      1 Reply Last reply
      1
      • T Offline
        T Offline
        torrancee
        wrote on last edited by
        #3

        @Eeli-K I replaced blinkingTimer.qml with your solution (just to ensure if its compiling) but error its still same

        E 1 Reply Last reply
        0
        • T torrancee

          @Eeli-K I replaced blinkingTimer.qml with your solution (just to ensure if its compiling) but error its still same

          E Offline
          E Offline
          Eeli K
          wrote on last edited by
          #4

          @torrancee You should replace the inner timer (BlinkingTimer) with a named property:

          property BlinkingTimer t2: BlinkingTimer {
          

          I don't know if this works, but a simple inner Timer as the attempted but non-existent default property gives the error for me, while the named property doesn't.

          1 Reply Last reply
          1
          • T Offline
            T Offline
            torrancee
            wrote on last edited by torrancee
            #5

            It's ok ! Thank you. I paste the code for other users:

            CowbellTimer.qml

            Timer {
                id: cowbellTimer
                interval: 1000
                triggeredOnStart: true
                running: false
                repeat: true
            
                property BlinkingTimer t2: BlinkingTimer {
                    id: cowbellBlinking
                }
            }
            
            1 Reply Last reply
            1

            • Login

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