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. Reset a QML property from Javascript
Forum Update on Monday, May 27th 2025

Reset a QML property from Javascript

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
4 Posts 3 Posters 468 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.
  • E Offline
    E Offline
    EddieC
    wrote on 1 Jan 2022, 05:29 last edited by EddieC 1 Jan 2022, 05:29
    #1

    Is there a way to reset a property in QML from Javascript? Apparently the way to reset a property in QML is to assign undefined to it, but attempting to do it from Javascript is resulting in type errors ("can't assign undefined to int", "can't assign undefined to double"). I've also tried null with the same results.

    R 1 Reply Last reply 15 Jan 2022, 00:16
    0
    • M Offline
      M Offline
      Markkyboy
      wrote on 1 Jan 2022, 15:34 last edited by
      #2

      @EddieC said in Reset a QML property from Javascript:

      reset a property in QML

      https://doc.qt.io/archives/qt-5.9/qml-qtquick-propertychanges.html

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

      I live by the sea, not in it.

      E 1 Reply Last reply 14 Jan 2022, 23:28
      0
      • M Markkyboy
        1 Jan 2022, 15:34

        @EddieC said in Reset a QML property from Javascript:

        reset a property in QML

        https://doc.qt.io/archives/qt-5.9/qml-qtquick-propertychanges.html

        E Offline
        E Offline
        EddieC
        wrote on 14 Jan 2022, 23:28 last edited by
        #3

        @Markkyboy said in Reset a QML property from Javascript:

        https://doc.qt.io/archives/qt-5.9/qml-qtquick-propertychanges.html

        So, the only way would be to create a dummy state with the PropertyChange and to activate the state? No way to act directly on the property?

        1 Reply Last reply
        0
        • E EddieC
          1 Jan 2022, 05:29

          Is there a way to reset a property in QML from Javascript? Apparently the way to reset a property in QML is to assign undefined to it, but attempting to do it from Javascript is resulting in type errors ("can't assign undefined to int", "can't assign undefined to double"). I've also tried null with the same results.

          R Offline
          R Offline
          raven-worx
          Moderators
          wrote on 15 Jan 2022, 00:16 last edited by
          #4

          @EddieC
          on what properties did you try it exactly?
          maybe the property does not have a reset method defined?

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          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