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 change notification

Property change notification

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 434 Views 1 Watching
  • 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.
  • X Offline
    X Offline
    xargs1
    wrote on last edited by xargs1
    #1

    I found something unexpected with onChange signals. If I have

    property int foo: 42
    onFooChanged: console.log(foo);
    

    This works as expected and I see nothing in the log unless foo is modified. But if I have

    readonly property int init: 42
    property int foo: init
    onFooChanged: console.log(foo);
    

    I will get a change notification in the log when the application starts. Is this expected behavior? Can it be changed?

    Qt 5.12.7

    1 Reply Last reply
    0
    • 6thC6 Offline
      6thC6 Offline
      6thC
      wrote on last edited by
      #2

      Well, you could bind to changed after | onCompleted?

      I wouldn't get too hung up on just this if I found out unless it is affecting behaviour or functionality. I do act quite defensively to references to c++ null refs etc in qml and really act to cut rebinds away entierly.

      To assist me greatly do this, early in main I turn on qt.qml.binding.removal.info category logging. e.g:

      QLoggingCategory::setFilterRules(QStringLiteral("qt.qml.binding.removal.info  =true\n"));
      

      That way only the qt/qml objects produce rebind warning or if mine, only very determined rebinds, which I plan on eventually clearing those (currently just one) too.

      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