Qaterial icon indicating copy to clipboard operation
Qaterial copied to clipboard

LabelWithCaption binding loop

Open ukenjutsu opened this issue 2 years ago • 3 comments

Qaterial.LabelWithCaption {
    anchors.centerIn: parent
    horizontalAlignment: Qt.AlignHCenter

    spacing: 10 // Binding loop detected for property "y"

    text: "I'm a simple label"
    caption: "Here is my caption text"

    textFont: Qaterial.Style.textTheme.headline5
    captionFont: Qaterial.Style.textTheme.body1
}

LabelWithCaption.qml: 48:3: QML Label: Binding loop detected for property "y"

Same problems with CaptionWithLabel, OverlineWithLabel and "maybe" IconLabelWithCaption, but I haven't tested it because IconLabelWithCaption (sure IconLabel too) doesn't work for me. It says "Could not resolve the prototype for Qaterial.IconLabelImpl" :(

ukenjutsu avatar Aug 16 '21 19:08 ukenjutsu

Are you sure you added qrc:/ to your import path.

QQmlApplicationEngine engine;
engine.addImportPath("qrc:/");

And binding loop seems to be cause by https://github.com/OlivierLDff/Qaterial/blob/ee1a464cf13d4cc79ea6361c1b496cf1075d286f/qml/Qaterial/LabelWithCaption.qml#L58-L65 I guess solution to avoid the binding loop is to either move implementation to cpp, or to change approach to use a column

OlivierLDff avatar Aug 17 '21 07:08 OlivierLDff

I just removed the spacing property for temporary fix the binding loop

I tested IconLabel again. It works and displays an icon, but QtCreator highlights it as an unresolved component Adding the engine.addImportPath("qrc:/"); does not solve this problem. On the contrary, it gives me even more problems. I am using Qaterial installed via CMAKE_INSTALL, and i put .qml files to Qt source folder C:\Qt\5.15.2\msvc2019_64\qml\Qaterial and if there is a warning in some qml file, QtCreator cannot open this file, because the location of this file is somewhere in the resource which I don't have qrc:/Qaterial/LabelWithCaption.qml:48:3: QML Label: Binding loop detected for property "y".

I think I included the Qaterial library incorrectly

Here is my little CMakeLists.txt

(sorry for bad english)

ukenjutsu avatar Aug 17 '21 10:08 ukenjutsu

Easiest way to add Qaterial is using something like that : https://github.com/OlivierLDff/QaterialHotReload/blob/master/cmake/FetchQaterial.cmake I think find_package is fine, but I'm not using this technique myself. I'm also not using QtCreator so I can't give you any help on that sorry. I think to have correct completation within QtCreator, you need to generate a qmltype file : https://doc.qt.io/qtcreator/creator-qml-modules-with-plugins.html

OlivierLDff avatar Aug 17 '21 11:08 OlivierLDff