Forums

OverviewFelgo 2 Support (Qt 5) › Extend ArrayDelegate – some more info needed

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #19165

    Marcin

    Hi Felgo,
    I need to extend ArrayDelegate in ItemEditor.
    The truth is, I already kind of figured it out quite well, thanks to Squaby demo and some debugging, but some bits are still not 100% clear for me.

    1.

    Could you provide full body of ArrayDelegate.qml, ArrayContentDelegate.qml and ArrayElementDelegate.qml?

    I only found some distributed with Felgo but it includes only body with public interface(properties and methods).
    Getting what is possible and how things work from debugging, without source, was really time consuming.
    Would be great if there was a better way to get more info than debugging different apps code.

     

    2.

    ArrayElementDelegate.qml provided with Felgo has just some properties and methods:

    Rectangle {
      property int waveIndex
      property int spacing
      property variant propMetaData
    
      property variant currentModelData
      property variant writeModel
      property variant model
      property bool defaultValueIsSet
      property variant repeater
    
      function changedValue(id,value) {
      }
    
    

    I understand few of the properties but could you add some more info?
    For example, what is the purpose and behavior of writeModel?
    Also, I don’t know which parameters are really required, I guess spacing is not mandatory?
    I think waveIndex is here by accident from the time when Squaby demo extended this template 🙂

    3.
    ArrayContentDelegate.qml body is:

    import Felgo 3.0
    import QtQuick 2.2
    import QtQuick.Controls 1.1
    
    
    Item {
    
      property variant repeater
      
      property variant propMetaData
    
      property Component elementDelegateComponent
    
    }
    

    Any more info on any of the properties would be great.
    Repeater is kind of clear and propMetaData.
    What about elementDelegateComponent, how is it used? In Squaby this value is not overridden, for example.

    4.
    Any extra behaviors would be awesome to explain a little.
    For example, how to add new object to array(model data), just change the model values? Is this the correct way?
    What about saving model, I guess item editor does it at the end based on model data?

    #19172

    Marcin

    5.
    There is some weird connection between repeater in ContentDelegate and ElementDelegate.
    Looks like EleementDelegate can access contentDelegate by repeater?
    What does repeater in element delegate mean?

    #19173

    Marcin

    Since I don’t have the source code for original files will rely on Squaby example and SimpleArrayDelegate/WaveArrayDelegate.
    In the end looks like there is no really interface for array delegate and the only requirement is that Element and Content delegates are components.
    The whole magic is really custom built in ArrayContentDelegateScrit.js.
    There is no magic connection between repeater property, for example, on c++ level.
    It’s all JS logic.
    I thought that it is a little different.
    For now will repeat the logic, including that javascript file, and try to change it the way I want.

    There is still some magic, like this writeData/writeModel properties etc. but, at this stage, will just make amends I need and will try to understand everything later.

    #19330

    Günther
    Felgo Team

    Hi Marcin,

    as Felgo is a closed-source Framework, we only offer source-code access for certain use-cases as part of our support offering for enterprise customers. (The only exception are the SocialView or Multiplayer / GameNetwork view sources, which are available with Felgo Indie).

    If you require certain additional features or different behavior for e.g. some Level Editor features, we can extend the feature set for you with the purchase of a support package. Just let us know what you need exactly and we’ll see to work on it with high-priority. If this is not an option, we can add your feature requests to our roadmap and prioritize internally to improve the Level Editor for some future update.

    Best,
    Günther

    #19332

    Marcin

    Hi Günther,
    Thank you for answer.
    In the end I managed to achieve what I wanted, basically by using normal ItemBaseDelegate and extending it(I have multiple times embedded arrays, so really none of the available items fits me right out of the box).
    The main thing what would be useful for me is documentation/explanation how really does modelWrite work?
    I sometimes still get the binding loop error for model or modelWrite.
    If possible would be great to explain shortly the best practice for extending.
    Basically answer for questions:
    1. When you create your own delegate, should you write directly to modelWrite or never do it?
    2. When you write your own logic to update model in custom delegate, on which event you should listen to and on which step update the model to avoid binding errors?

    Thank you in advance

Viewing 5 posts - 1 through 5 (of 5 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support