1
votes

I want to create a breadcrumb in QML.

So to have a dynamic C++ model, displayed as an horizontal list of items. Each item has a fixed size to only display its content (basically a string).
I need to display all items (with the maximum of almost my window width), on top of my main background (a working area), so transparent except for the items.

What is the best container to use for that case ? Considering I do not need to scroll.
Row, RowLayout, ListView ?

1
I would do that using Flow. It makes sense if your item will fit more them one row. In case of only one row Row or RowLayout could be used.folibis
@folibis you're right, good idea. But in my case I am sure I will have only one row, and I am not sure our Qt version is recent enough for Flow.ymoreau
See me comment below.folibis
I'd personally prefer it scrollable if it is too long, rather than going multi-line and eating screen space. A row with a repeater is perfectly fine.dtech

1 Answers

3
votes

Here is a code for my comment above. Flow could be replaced with Row if needed.

Flow {
    spacing: 3
    width: parent.width
    Repeater {
        model: ["root", "item1","subitem1","one more items","subitem2","item3"]
        delegate: Label {
            padding: 10
            text: modelData
            background: Rectangle {
                color: "#DEDEDE"
            }
        }
    }        
}