Skip to content

Allow arbitrary ordering of nodes in the context menu #147

Open
@Quincunx271

Description

@Quincunx271

The ordering of nodes inside the DataModelRegistry is currently pretty arbitrary. When you open the context menu, the nodes are ordered by Category (sorted, as it uses std::set), but within each category, there is no ordering. If I understand the code correctly, this is because RegisteredModelsCategoryMap is a std::unordered_map.

I think it's beneficial to allow this ordering to be fully specified by a user of this library, or at least the order of nodes within any given category.

My proposal is thus the following:

  • Keep the models of a given category in the order that they were registered. This is backwards compatible, assuming the user doesn't rely on the iteration order of unordered_map
  • Keep the categories in the order that they are inserted in via registerModel. Basically, use a std::vector instead of a std::set. It might be a good idea to add a sortCategories() function. This is backwards incompatible, but I think it's valuable. If we want to stay backwards compatible, there should at least be a way to specify the order of the categories.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions