QML QQuickText: cannot bind to an element that is not a parent or sibling

When I use TumblerColumnin mine Tumbler, I get QML QQuickText: Cannot anchor to an item that isn't a parent or sibling. When I use only Tumbler, the error does not appear. I can not understand what the problem is with TumblerColumn.

Here is my Dialogcode

import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Dialogs 1.2
import QtQuick.Extras 1.2

Dialog {
    id: customTimerInputDialog
    title: "Custom timer"
    height: 150
    width: 300
    standardButtons: StandardButton.Ok | StandardButton.Cancel
    onAccepted: {

    }

    onRejected: {
        console.log("Rejected")
    }

    Column {
        anchors.fill: parent
        Text {
            text: "Timer"
            height: 40
        }

        Tumbler {
            id: tumbler
            TumblerColumn {
                model: 10
            }

            TumblerColumn {
                model: 60
            }
        }
    }
}

TumblerColumn (TumblerStyle.qml) full source code

...
// line 294
property Component delegate: Item {
    implicitHeight: (control.height - padding.top - padding.bottom) / tumblerStyle.visibleItemCount

    Text {
        id: label
        text: styleData.value
        color: "#666666"
        opacity: 0.4 + Math.max(0, 1 - Math.abs(styleData.displacement)) * 0.6
        font.pixelSize: Math.round(TextSingleton.font.pixelSize * 1.25)
        anchors.centerIn: parent
    }
}
...

Error message enter image description here

UPDATE

I get the same error with Popup QML Type

Popup {
    id: popup
    x: 100
    y: 100
    width: 200
    height: 300
    modal: true
    focus: true
    closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent

    Tumbler {
        id: intervalPicker
        TumblerColumn {
            model: 10
        }

        TumblerColumn {
            model: 60
        }
    }
}
+4
source share
1 answer

Quick Controls Qt 1 2. /Popup QtQuick.Controls 2.2 QtQuick.Extras 1.2. Tumbler, Qt Quick Extras Qt Quick Controls 1 (. TumblerStyle.qml).

TumblerColumn TumblerStyle, Tumbler Qt Quick Extras 1.2.

Tumbler Qt Quick Controls 2, - Tumbler Qt Quick Extras 1.2.

Qt Quick Extras 1.2, Qt Quick Controls 2 qml , as:

import QtQuick.Extras 1.2 as Extra
import QtQuick.Controls 2.2 as Controls2

...
Extra.Tumbler 
{
...
}

Controls2.Tumbler 
{
...
}
...
-1

Source: https://habr.com/ru/post/1690919/


All Articles