Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bindings are disabled for width/height of items inside Flex #2

Open
nuttyartist opened this issue Jul 3, 2024 · 0 comments
Open

Bindings are disabled for width/height of items inside Flex #2

nuttyartist opened this issue Jul 3, 2024 · 0 comments

Comments

@nuttyartist
Copy link

Hello, thanks for this great repo! I think Flexbox is an awesome an idea. I know it's been a long time since you've worked on this repo but one thing I noticed is that bindings to the width/height properties of items inside a Flex item aren't working.

For example, in the following example below, rect2 won't update its width when the with of the window changes, like it should.

import QtQuick

Window {
    id: root
    visible: true
    height: 400
    width: 675

    property bool isMobile: width < 550

    Flex {
        flexDirection:  root.isMobile ? "column" : "row"
        anchors.fill: parent
        flexWrap: "noWrap"
        justifyContent: "spaceBetween"
        alignItems: "center"
        alignSelf: "center"
        alignContent: "stretch"

        Rectangle {
            width: 200
            height: 200
            color: "blue"
        }

        Rectangle {
            id: rect2
            width: root.width * 0.5
            height: 200
            color: "red"
        }

    }
}

Adding the following code does make it work, tho:

onWidthChanged: {
    rect2.width = root.width * 0.5
}

I wonder why the bindings suddenly don't work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant