Skip to content

Why does the boxes overlap with each other? #733

Answered by bjorn
hbina asked this question in Q&A
Discussion options

You must be logged in to vote

The Rectangle will not automatically take the size of the Text element inside. You could achieve this with a binding (though I'm not sure it's the best way):

        ListView {
            for data in mongodb-documents : Rectangle {
                background: red;
                border-width: 5px;
                border-color: blue;
                clip: false;
                height: text.height + 10px; // makes rectangle height of text plus space for border
                text := Text {
                    x: 5px; // added to make sure the text isn't on the border
                    x: 5px;
                    text: data;
                    color: blue;
                }
          …

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@hbina
Comment options

@bjorn
Comment options

Answer selected by hbina
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants