Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business


OverviewFelgo 3 Support (Qt 5) › Save all entity properties

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #9759



    I’m using LevelEditor and I would like to know if it is possible to save all the data that contains an entity ?
    As I could see, there are always these data saved :


    But my entity have other properties that I want to save. For example :

        id: domainEntry
        entityType: "domainEntry"
        variationType: "domainEntry"
        property string name
        property string type
        property int memory

    What should I do to solve this ?



    Felgo Team

    Hi Vladimir,

    excellent question! 🙂

    Are you also using the ItemEditor to change the properties at runtime for balancing during game creation? If you use it, the entities you use with ItemEditor are automatically stored with the LevelEditor.

    If you do not want to use ItemEditor (although I’d strongly recommend it), you can use EntityBase::toStoreProperties to define which properties you want to save in a call of LevelEditor::saveCurrentLevel().

    Cheers, Chris



    Thank you Chris for your solutions !
    I tried with “toStoreProperties” but my application crashed :

    qml: EntityManager: storeEntitesAsJson: storing entity Entity_QMLTYPE_52(0x2d4b320, "entity_switchEntity_5") of type entity and id entity_switchEntity_5
    qml: EntityManager: storing property from toStoreProperties array of entity entry with value SwitchEntry_QMLTYPE_187(0x313db10, "switchEntry_switchEntry_4")
    terminate called after throwing an instance of 'std::bad_alloc'
      what():  std::bad_alloc

    I have this structure :
    – Entity is a component specialized into SwitchEntity.
    – an Entity has an EntityEntry ( specialized into SwitchEntry )

    So we have
    “Abstract Components”

        id: entity
        entityType: "entity"
        toStoreProperties: ["entry"]
        property EntityEntry entry
        id: entityEntry
        entityType: "entityEntry"
        variationType: "entityEntry"
        property bool saved: false
        property bool isTemplate: false
        property bool isModel: false
        property bool hasRessources: false
        property EntryProperties properties



    “Concret Components”

        id: switchEntity
        entityType: "entity"
        variationType: "switchEntity"
        entry: entry
            id: image
            anchors.fill: parent
            source: "../../assets/switch.svg"
            id: entry
        id: switchEntry
        entityType: "switchEntry"
        variationType: "switchEntry"
        properties: properties
        property string type
        property int ports
        property bool isHub
        property bool stpEnabled
        property int portMirroring
        SwitchEntryProperties{id: properties}


    I don’t know why it is crashing when I’m saving the level ( It happens when I want to store a component property )
    I tried your first solution by putting an ItemEditor in my Scene but the data still are the same.


    • This reply was modified 8 years, 10 months ago by  Reyarc.
    • This reply was modified 8 years, 10 months ago by  Reyarc.

    Felgo Team

    The toStoreProperties must be basic types like int, string, arrays or variants and cannot be a custom QML type. Please try to change the structure to only save the stored properties within your EntityEntry.

    Cheers, Chris

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

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded