Code Monkey home page Code Monkey logo

qml-flexbox's Introduction

Contact data

Telegram: @ptr98
Email: [email protected]

Other links

StackOverflow: https://stackoverflow.com/users/7388307
Behance: https://www.behance.net/tripolskypetr

Tech Skills

  • PWA Architect

OOP, FP, SOLID, Design Patterns, Serverless Architecture, REST API

  • Data Scientist

NumPy, SymPy, matplotlib, pandas, SciPy, scikit-*

  • DeFi

Binance APIs, ERC721A, ERC20, OpenZeppelin, Geth, MetaMask, Infura

See Also

I co founded a startup centred around the implementation of an esports platform where AI is acting as a casino croupier, determining the winner of cybersport competitions based on video captured from the user's screen during a match

I have a serious contribution to the open source movement on GitHub. I also have StackOverflow account.

qml-flexbox's People

Contributors

tripolskypetr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

qml-flexbox's Issues

Repeater support

Hi!
Firstly, thanks for the component! I tried it, works great.

But I got a problem with the Repeater component.
It seems the alignment is not calculated correctly.

Without Repeater component:

Снимок экрана 2020-05-28 в 14 26 07

import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Window 2.12

ApplicationWindow {
    visible: true
    width: 400; height: 100

    Flex {
        width: parent.width
        height: parent.height
        justifyContent: "spaceBetween"
        alignItems: "center"
        
        Button {
            text: "0"
        }

        Button {
            text: "1"
        }

        Button {
            text: "2"
        }
    }
}
With Repeater component:

Снимок экрана 2020-05-28 в 14 31 24

import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Window 2.12

ApplicationWindow {
    visible: true
    width: 400; height: 100

    Flex {
        width: parent.width
        height: parent.height
        justifyContent: "spaceBetween"
        alignItems: "center"

        Repeater {
            model: 3

            Button {
                text: index
            }
        }
    }
}

I tried a little bit to debug Flex.qml component.
I added console.log(child) in this place:

child = flex.children[i];

and get output:

qml: Button_QMLTYPE_1(0x7fe2174a7e60)
qml: Button_QMLTYPE_1(0x7fe217614cb0)
qml: Button_QMLTYPE_1(0x7fe217568cd0)
qml: QQuickRepeater(0x7fe2177b07d0)

In next step, I added break for instance of Repeater component and now it's render correctly.

Full code of updatePositions()

function updatePositions() {
    if (flex.height != 0 && flex.width != 0) {
        var rootNode = backend.createNode();
        processNode(flex, rootNode);
        var nodes = []
        var node = {}
        var child = {}
        var i = 0;
        for (i = 0; i !== flex.children.length; i++) {
            child = flex.children[i];

            // remove Repeater components from future layout calculation
            if (child instanceof Repeater) break;

            node = backend.createNode();
            if (isFlex(child)) {
                processNode(child, node);
            } else {
                setDefaultNodeProps(child, node);
            }
            nodes.push(node);
        }
        rootNode.appendChildren(nodes);
        rootNode.calculateLayoutLtr(flex.width, flex.height);
        for (i = 0; i !== flex.children.length; i++) {
            node = nodes[i];
            if (!node) break;
            flex.children[i].x = node.getLayoutLeft();
            flex.children[i].y = node.getLayoutTop();
            flex.children[i].width = node.getLayoutWidth();
            flex.children[i].height = node.getLayoutHeight();
        }
        backend.collectGarbage(rootNode);
        return true;
    } else {
        return false;
    }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.