Home > Net >  Logical value does not depend on actual values (M325)
Logical value does not depend on actual values (M325)

Time:05-26

How should this warning be fixed?

Repeater {
    model: n
    SomeItem {
        onValueChanged: if(index === 0) root.myreset()
    }
}

(warning is on the === comparison)

CodePudding user response:

I can't reproduce it on Qt Creator 7.0.1 on Windows using Desktop Qt 6.3.0 MinGW kit. According to this bug report QTCREATORBUG-25917 it has been fixed in Qt Creator 7.0.0. That bug report also tells that a workaround for this warning occuring with index property in a delegate (which is a special property exposed from model to delegate) is to specify the parent of the object it belongs to, i.e. model.index.

Repeater {
    model: n
    SomeItem {
        onValueChanged: if(model.index === 0) root.myreset()
    }
}
  • Related