[Interest] QML: Strange "binding loop detected" message

Alexander Dyagilev alervdvcw at gmail.com
Fri Apr 2 07:53:09 CEST 2021


Hello,

I have a table. I change one column's size when user hovers it. Each row 
in this column can require different "hovered" width. And I would like 
it to return back in 3 seconds after mouse pointer left it.

So, I use this:

property bool viewSpeedColumnHovered: false
property int  viewSpeedColumnHoveredWidth: 0
property double viewSpeedColumnNotHoveredSinceTime: 0

These properties are set outside of my control and the question is not 
about them.

To achieve the above I use this property:

//keephoveredwidthatmaxrecentvalue+3secondsafterleavinghoveredstate
property int speedColumnHoveredWidth: downloadsViewSpeedColumnHovered ?
Math.max(speedColumnHoveredWidth, viewSpeedColumnHoveredWidth) :
                                               (currentTime - 
viewSpeedColumnNotHoveredSinceTime < 3000) ? speedColumnHoveredWidth :
                                               0

When I hover the column first time - all is OK. But after 3 seconds has 
passed, it returns to 0. My column became normal again. Then I hover it 
again and get this strange message:

QML ViewHeaderColumnsWidthCalc: Binding loop detected for property 
"speedColumnHoveredWidth"

I can't understand how can this be... If Math.max returns the property 
itself (speedColumnHoveredWidth), then it should not generate "changed" 
signal (property remains the same).

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20210402/7c94a1b1/attachment-0001.html>


More information about the Interest mailing list