[Interest] QML: Strange "binding loop detected" message
Alexander Dyagilev
alervdvcw at gmail.com
Sat Apr 3 10:55:28 CEST 2021
OK, I've just refactoring it in this way and the problem is solved now.
It's sad that it's impossible to use self-variable in the binding
without getting boring warnings...
propertyintspeedColumnHoveredWidth:0
onCurrentTimeChanged:updateSpeedColumnHoveredWidth()
onDownloadsViewSpeedColumnHoveredChanged:updateSpeedColumnHoveredWidth()
onDownloadsViewSpeedColumnHoveredWidthChanged:updateSpeedColumnHoveredWidth()
onDownloadsViewSpeedColumnNotHoveredSinceTimeChanged:updateSpeedColumnHoveredWidth()
functionupdateSpeedColumnHoveredWidth()
{
//keephoveredwidthatmaxrecentvalue+3secondsafterleavinghoveredstate
varw=downloadsViewSpeedColumnHovered?
Math.max(d.speedColumnHoveredWidth,downloadsViewSpeedColumnHoveredWidth):
(d.currentTime-downloadsViewSpeedColumnNotHoveredSinceTime<3000)?d.speedColumnHoveredWidth:
0;
if(w!=d.speedColumnHoveredWidth)
d.speedColumnHoveredWidth=w;
}
On 4/2/2021 8:53 AM, Alexander Dyagilev wrote:
>
> 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/20210403/553b7b86/attachment-0001.html>
More information about the Interest
mailing list