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. QML QQuickItem: Binding loop detected for property "y" - false positive?

QML QQuickItem: Binding loop detected for property "y" - false positive?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 1 Posters 466 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.
  • N Offline
    N Offline
    NickAger
    wrote on last edited by NickAger
    #1

    I think I am seeing some false positives from the QML binding loop detector.

    As an example:

    From within Design Studio:

    1. Add New ...
    2. Select "Qt Quick Controls"
    3. Select "Custom Dial"
    4. Give it a name
    5. Insert newly created custom dial onto a page
    6. Run project
    7. In the Application Output window see the warnings: ....MyProjectContent/DialControl.ui.qml:31:9: QML QQuickItem: Binding loop detected for property "y"

    Line 31 reads:

           y: control.background.y + control.background.height / 2 - height / 2
    

    the complete qml for the control is:

    /*
    This is a UI file (.ui.qml) that is intended to be edited in Qt Design Studio only.
    It is supposed to be strictly declarative and only uses a subset of QML. If you edit
    this file manually, you might introduce QML code that is not supported by Qt Design Studio.
    Check out https://doc.qt.io/qtcreator/creator-quick-ui-forms.html for details on .ui.qml files.
    */
    import QtQuick
    import QtQuick.Controls
    
    Dial {
        id: control
        property alias controlEnabled: control.enabled
        background: backgroundRect
        Rectangle {
            id: backgroundRect
            x: control.width / 2 - width / 2
            y: control.height / 2 - height / 2
            implicitWidth: Math.max(64, Math.min(control.width, control.height))
            implicitHeight: width
            color: "transparent"
            radius: control.width / 2
            border.color: "#047eff"
            border.width: 2
        }
    
        handle: Item {
            id: handleParent
            x: control.background.x + control.background.width / 2 - width / 2
            y: control.background.y + control.background.height / 2 - height / 2
            transform: [
                Translate {
                    y: -Math.min(
                           control.background.width,
                           control.background.height) * 0.4 + handleParent.height / 2
                },
                Rotation {
                    angle: control.angle
                    origin.x: handleParent.width / 2
                    origin.y: handleParent.height / 2
                }
            ]
            width: handleItem.width
            height: handleItem.height
        }
    
        Rectangle {
            id: handleItem
            parent: handleParent
    
            width: 16
            height: 16
            color: "#047eff"
            radius: 8
            border.color: "#047eff"
            antialiasing: true
        }
        states: [
            State {
                name: "normal"
                when: !control.pressed && control.enabled
    
                PropertyChanges {
                    target: handleItem
                    color: "#047eff"
                }
            },
            State {
                name: "disabled"
                when: !control.enabled
    
                PropertyChanges {
                    target: handleItem
                    opacity: 1
                    color: "#7f047eff"
                    border.color: "#00000000"
                }
    
                PropertyChanges {
                    target: background
                    opacity: 0.3
                }
    
                PropertyChanges {
                    target: backgroundRect
                    border.color: "#7f047eff"
                }
            },
            State {
                name: "pressed"
                when: control.pressed
    
                PropertyChanges {
                    target: handleItem
                    color: "#047eff"
                    border.color: "#ffffff"
                }
    
                PropertyChanges {
                    target: backgroundRect
                    border.color: "#047eff"
                }
            }
        ]
    }
    

    Is there a binding loop here, or is this a false positive, or is this a bug with the Design Studio "Custom Dial"?

    Using: Qt Design Studio 4.6 (4.6.2)
    Targeting Qt 6.8

    1 Reply Last reply
    0
    • N Offline
      N Offline
      NickAger
      wrote on last edited by NickAger
      #2

      Is is also odd that the binding loop detector does not complain about the line above where is it claiming a binding loop which ostensibly appears to be binding in a similar way: x: control.background.x + control.background.width / 2 - width / 2

      Correction
      if I reorder these two lines I do get a binding loop warning for x: control.background.x + control.background.width / 2 - width / 2 but not for y: control.background.y + control.background.height / 2 - height / 2

      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