[Interest] XYZ is instantiated recursively

Dmitry Volosnykh dmitry.volosnykh at gmail.com
Thu Jan 15 13:46:16 CET 2015


Following your first snippet, I think that it is in general impossible to
refer component inside its definition since QML engine will not know what
it looks like at the moment.

On Thu, Jan 15, 2015 at 1:06 PM, Nuno Santos <nunosantos at imaginando.pt>
wrote:

> Dimitry,
>
> You are right. Let’s start by the model.
>
> My model is made of devices which can have list of devices (recursive
> model).
>
> I want to list A’s so I do something like:
>
> ListView {
> model: model.devices
> delegate: Device {
> parameters: modelData.parameters
> devices: modelData.devices
> }
>
> // Device.qml
>
> Rectangle {
> id: root
>
> property alias parameters: parameters.model
> property alias devices: devices.model
>
> ListView {
> id: parameters
> }
>
> Device {
> id: devices
>
> }
> }
>
> Qml output: Device is istantiated recursively
>
> Regards,
>
> Nuno
>
> On 15 Jan 2015, at 10:00, Dmitry Volosnykh <dmitry.volosnykh at gmail.com>
> wrote:
>
> Nuno, it is sometimes hard to get an idea of what exactly you are trying
> to do without any minimal sample code provided.
>
> On Thu, Jan 15, 2015 at 12:57 PM, Nuno Santos <nunosantos at imaginando.pt>
> wrote:
>
>> Hi,
>>
>> I’m building a QML UI interface for a model that can have a recursive
>> behaviour
>>
>> I’m trying to instantiate a custom module inside a custom module and it
>> is saying XYZ is instantiated recursively.
>>
>> Why does this error doesn’t occur when you instantiate a Rectangle inside
>> a Rectangle? Isn’t that the same?
>>
>> If I really want the same module to appear to model that by it’s own is
>> recursive, what should I do? I cannot have a different Qml file for each
>> recursive depth as I don’t know what will be the total depth of it. And it
>> simply doesn’t make sense…
>>
>> Any ideas?
>>
>> Thanks,
>>
>> Nuno Santos
>> _______________________________________________
>> Interest mailing list
>> Interest at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/interest
>>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150115/8ab8d86f/attachment.html>


More information about the Interest mailing list