Well there is no built-in way, but I found a workaround for this.
The idea is simple, since Flow already Item it is anchors.leftMargin and anchors.rightMargin . Therefore, if we can calculate how many elements are inside the Flow line, then we can calculate the left and right fields. Therefore, we can focus.
Here is a simple code,
Flow { property int rowCount: parent.width / (elements.itemAt(0).width + spacing) property int rowWidth: rowCount * elements.itemAt(0).width + (rowCount - 1) * spacing property int mar: (parent.width - rowWidth) / 2 anchors { fill: parent leftMargin: mar rightMargin: mar } spacing: 6 Repeater { id: elements model: 5 Rectangle { color: "#aa6666" width: 100; height: 100 } }
source share