Unsolved Include new QmlComponent after or before another. How?
-
Hello all!
I need to be able to manage order of child components:
- to be able insert after defined component;
- to be able insert before defined component;
Is it possible to do so?
-
Yes, just insert at a particular place in children list.
However, if you're doing that, you probably need to look at model-based views like ListView, GridView etc.
-
@sierdzio Do you mean get children list and insert into it pointer on object in particular place? Am I right?
-
import QtQuick 2.12 import QtQuick.Controls 2.12 Item { // https://doc.qt.io/qt-5/qml-qtquick-item.html // data is for any type of object to be added visual or not // children is for visual // resources is for non visual // places items by default in content object default property alias _contentChildren: row0.data Row { id: row0 spacing: 5 padding: 5 } // places items when using this syntax /* row1: Item{} // as item row2: [Item{}, Item{}] // as list */ property alias row1: row1.children property alias row2: row2.children property alias row3: row3.children Row { id: row1 spacing: 5 padding: 5 anchors.left: row0.right } Row { id: row2 spacing: 5 padding: 5 anchors.left: row1.right } Row { id: row3 spacing: 5 padding: 5 anchors.left: row2.right } }
-
@bogong said in Include new QmlComponent after or before another. How?:
@sierdzio Do you mean get children list and insert into it pointer on object in particular place? Am I right?
Yep, that can even be done from C++ side.