I'm currently trying to create a sort of generic QML component for some tool window I'm planning.
Is there a way to actually set the size of said window according to the size of the ListView it contains? The size of the ListView would be partly dependent on the model data that its delegate is rendering. Here is a code example, which would be instantiated from somewhere outside:
import QtQuick 2.2
import QtQuick.Window 2.2
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3
Window{
id:window
title: "WindowTitle"
modality: "ApplicationModal"
flags: "Dialog"
ListView {
id: list
model: model_inst
delegate: RowLayout{
id: list_entry
Text {
text: "Model-based variable length text: " + text
}
ComboBox {
model: listrole
}
Switch {
text: qsTr("Switch")
}
}
}
}
So basically I am trying to access e.g. list_entry.width as a source for the window width as id does not work since the delegate will probably be used after the initial QML instantiation?
Not sure if there is a way at all or I'm inevitably trying to build some sort of reference loop. Thanks!